net: bnx2x: fix variable dereferenced before check
authorPavel Skripkin <paskripkin@gmail.com>
Sat, 13 Nov 2021 22:36:36 +0000 (01:36 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 10:48:41 +0000 (11:48 +0100)
commit21c6e6e40d1534a1a78092ded4a7a802b70d60a5
tree697fc7fb0a8c377cd4f21281f1bb8b6063bf21ff
parent997443875a7223dc2b55e2e81b69985670b4d078
net: bnx2x: fix variable dereferenced before check

[ Upstream commit f8885ac89ce310570e5391fe0bf0ec9c7c9b4fdc ]

Smatch says:
bnx2x_init_ops.h:640 bnx2x_ilt_client_mem_op()
warn: variable dereferenced before check 'ilt' (see line 638)

Move ilt_cli variable initialization _after_ ilt validation, because
it's unsafe to deref the pointer before validation check.

Fixes: 523224a3b3cd ("bnx2x, cnic, bnx2i: use new FW/HSI")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h