linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qed: Fix the use of NULL pointer
@ 2021-11-05 10:19 Jiasheng Jiang
  0 siblings, 0 replies; only message in thread
From: Jiasheng Jiang @ 2021-11-05 10:19 UTC (permalink / raw)
  To: aelior, GR-everest-linux-l2, davem, kuba, ast, daniel, hawk,
	john.fastabend
  Cc: netdev, linux-kernel, bpf, Jiasheng Jiang

If the return value of 'IS_PF(cdev)' is False, then 'p_ptt'
is NULL and the check 'if (IS_PF(cdev) && !p_ptt)' can be
passed through.
Then 'p_ptt' will be used in qed_memcpy_to().
However, 'p_ptt' will be used there, such as 'p_ptt->idx'.
Thus it might be better to fix it.

Fixes: dacd88d ("qed: IOV l2 functionality")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/ethernet/qlogic/qed/qed_l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
index dfaf10e..f5ada83 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
@@ -1932,7 +1932,7 @@ void qed_reset_vport_stats(struct qed_dev *cdev)
 						    : NULL;
 		u32 addr = 0, len = 0;
 
-		if (IS_PF(cdev) && !p_ptt) {
+		if (!p_ptt) {
 			DP_ERR(p_hwfn, "Failed to acquire ptt\n");
 			continue;
 		}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-05 10:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 10:19 [PATCH] net: qed: Fix the use of NULL pointer Jiasheng Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).