linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: aelior@marvell.com, GR-everest-linux-l2@marvell.com,
	davem@davemloft.net, kuba@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] net: qed: Fix the use of NULL pointer
Date: Fri,  5 Nov 2021 10:19:46 +0000	[thread overview]
Message-ID: <1636107586-3960637-1-git-send-email-jiasheng@iscas.ac.cn> (raw)

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


                 reply	other threads:[~2021-11-05 10:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1636107586-3960637-1-git-send-email-jiasheng@iscas.ac.cn \
    --to=jiasheng@iscas.ac.cn \
    --cc=GR-everest-linux-l2@marvell.com \
    --cc=aelior@marvell.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).