Skip to content

Commit 9ca0652

Browse files
committed
afs: Fix use of BUG()
Fix afs_compare_addrs() to use WARN_ON(1) instead of BUG() and return 1 (ie. srx_a > srx_b). There's no point trying to put actual error handling in as this should not occur unless a new transport address type is allowed by AFS. And even if it does, in this particular case, it'll just never match unknown types of addresses. This BUG() was more of a 'you need to add a case here' indicator. Reported-by: Kees Cook <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Kees Cook <[email protected]>
1 parent 5749ce9 commit 9ca0652

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/afs/vl_alias.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ static int afs_compare_addrs(const struct sockaddr_rxrpc *srx_a,
7373
}
7474

7575
default:
76-
BUG();
76+
WARN_ON(1);
77+
diff = 1;
7778
}
7879

7980
out:

0 commit comments

Comments
 (0)