From: David Howells Date: Tue, 9 Jun 2020 15:15:45 +0000 (+0100) Subject: afs: Fix use of BUG() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9ca0652596bd924a4023db6b429a0aaaea629826;p=linux.git 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 Signed-off-by: David Howells Reviewed-by: Kees Cook --- diff --git a/fs/afs/vl_alias.c b/fs/afs/vl_alias.c index 093895c49c219..136fc6164e009 100644 --- a/fs/afs/vl_alias.c +++ b/fs/afs/vl_alias.c @@ -73,7 +73,8 @@ static int afs_compare_addrs(const struct sockaddr_rxrpc *srx_a, } default: - BUG(); + WARN_ON(1); + diff = 1; } out: