mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
a345ce71e5
commit
58fee00ffa
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue