Re: [PATCH] Bluetooth: hci_conn: Refactor hci_bind_bis() since it always succeeds
From: Simon Horman
Date: Sat Jan 28 2023 - 08:45:08 EST
On Fri, Jan 27, 2023 at 04:51:54PM -0800, Kees Cook wrote:
> The compiler thinks "conn" might be NULL after a call to hci_bind_bis(),
> which cannot happen. Avoid any confusion by just making it not return a
> value since it cannot fail. Fixes the warnings seen with GCC 13:
>
> In function 'arch_atomic_dec_and_test',
> inlined from 'atomic_dec_and_test' at ../include/linux/atomic/atomic-instrumented.h:576:9,
> inlined from 'hci_conn_drop' at ../include/net/bluetooth/hci_core.h:1391:6,
> inlined from 'hci_connect_bis' at ../net/bluetooth/hci_conn.c:2124:3:
> ../arch/x86/include/asm/rmwcc.h:37:9: warning: array subscript 0 is outside array bounds of 'atomic_t[0]' [-Warray-bounds=]
> 37 | asm volatile (fullop CC_SET(cc) \
> | ^~~
> ...
> In function 'hci_connect_bis':
> cc1: note: source object is likely at address zero
>
> Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
...
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
> ---
> net/bluetooth/hci_conn.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
Is this really a 'fix' ?
In any case, the change looks good to me.
Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>