Patch "net: bnx2x: fix variable dereferenced before check" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: bnx2x: fix variable dereferenced before check

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-bnx2x-fix-variable-dereferenced-before-check.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 62db9b51bbbad9386517bb73cd0b80654af26056
Author: Pavel Skripkin <paskripkin@xxxxxxxxx>
Date:   Sun Nov 14 01:36:36 2021 +0300

    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@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
index 1835d2e451c01..fc7fce642666c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
@@ -635,11 +635,13 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num,
 {
 	int i, rc;
 	struct bnx2x_ilt *ilt = BP_ILT(bp);
-	struct ilt_client_info *ilt_cli = &ilt->clients[cli_num];
+	struct ilt_client_info *ilt_cli;
 
 	if (!ilt || !ilt->lines)
 		return -1;
 
+	ilt_cli = &ilt->clients[cli_num];
+
 	if (ilt_cli->flags & (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM))
 		return 0;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux