diff options
author | Yuval Mintz <Yuval.Mintz@qlogic.com> | 2014-08-17 15:47:50 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-22 21:31:16 +0200 |
commit | 58fee00ffae3b13b86f801146631012b3db4cea4 (patch) | |
tree | 8b0e7cc2456160bd38d9d6269b7b5f7bff6c442c | |
parent | bnx2x: Prevent pci_disable_sriov with assigned VFs (diff) | |
download | linux-58fee00ffae3b13b86f801146631012b3db4cea4.tar.xz linux-58fee00ffae3b13b86f801146631012b3db4cea4.zip |
bnx2x: Make BP_VF more robust
Prevent dereference of pointer in case it's NULL.
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h index ca1055f3d8af..01bafa4ac045 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h @@ -299,7 +299,8 @@ struct bnx2x_vfdb { #define BP_VFDB(bp) ((bp)->vfdb) /* vf array */ struct bnx2x_virtf *vfs; -#define BP_VF(bp, idx) (&((bp)->vfdb->vfs[idx])) +#define BP_VF(bp, idx) ((BP_VFDB(bp) && (bp)->vfdb->vfs) ? \ + &((bp)->vfdb->vfs[idx]) : NULL) #define bnx2x_vf(bp, idx, var) ((bp)->vfdb->vfs[idx].var) /* queue array - for all vfs */ |