Re: [PATCH 3/6] afs: Fix use of BUG()

From: Kees Cook
Date: Tue Jun 09 2020 - 12:19:21 EST


On Tue, Jun 09, 2020 at 05:13:26PM +0100, David Howells wrote:
> 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 <keescook@xxxxxxxxxxxx>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks!

--
Kees Cook