Skip to content

Commit f8885ac

Browse files
pskrgagdavem330
authored andcommitted
net: bnx2x: fix variable dereferenced before check
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: 523224a ("bnx2x, cnic, bnx2i: use new FW/HSI") Signed-off-by: Pavel Skripkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2153bd1 commit f8885ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,13 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num,
635635
{
636636
int i, rc;
637637
struct bnx2x_ilt *ilt = BP_ILT(bp);
638-
struct ilt_client_info *ilt_cli = &ilt->clients[cli_num];
638+
struct ilt_client_info *ilt_cli;
639639

640640
if (!ilt || !ilt->lines)
641641
return -1;
642642

643+
ilt_cli = &ilt->clients[cli_num];
644+
643645
if (ilt_cli->flags & (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM))
644646
return 0;
645647

0 commit comments

Comments
 (0)