Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2707012pxb; Fri, 5 Nov 2021 03:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIaIY1tY0vnebOVcXCMQZC1OFDp53mF5dSmEBEBrCU9tOfWn7f+n1N5OjezNftg9vsQPf1 X-Received: by 2002:a17:906:9f21:: with SMTP id fy33mr69736372ejc.567.1636107801719; Fri, 05 Nov 2021 03:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636107801; cv=none; d=google.com; s=arc-20160816; b=OOIZjngeIM68ol5PIUcBnQz7ubcaAA/rcl1wemFsGaKG3wFMFkg+b6pHL/ZtqhON94 21i/MDPBl/JTuihHFpuUhh2/a78smAVge35U7vQ/8n0aPATMZdu3ZutkJNZV41P01GZ4 aoKM2ffuoggJBC1MYgrkTzdn0n3rQv4WT1P+RG80I6JVJT9NNSfAEGBc167EzibnnDYr JfJR31QntFGF7VO91CDSIh/kqNbNxrHKdXka1sPPGqljI/EB6+fV09sxGDgZzRf53d+k 02eXcb3UZLNZV5NS2u2AEHh+fJYSobaWNUGMcs4gdyuNlsIZDVqx0s/z8OsnyOKqZLgm VIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Vjho8IJsFt4UotdzFcy0yM6/cKAoAWb9unVArf6ZQbw=; b=k4XXUAGDioaq1VhTn5LNPd8aqdsz9qqr0uP7yUqxld0fn0nde4y0n4tYecrYpQ/LL4 e8DlKp2j+kJpYb7hOO5N4QQeUtmY+YtJO+PhyNYoEEUCiNy64lJdtXwiFvU+J5YNEw/6 +S/PUNHbH4BZAQBTOlHS4AmoUyw2M9B1+qvLx0Kn40Fm1h0o+yZ2x8YXFxDqHIqjUIJT 0yJkHfhOl6iAlDnA5hBFE7MmOK4KYysYII5Wl9XZlhWIBMJYCH9y7/sffR6MjcGWmCrV pnmK24yiHV2XDiN+/ePsnR0rcg9npN/oh6x6m0ydUD5ic7iVFofhlT5Up9vwamop3Ye6 agMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si14153385edd.413.2021.11.05.03.22.57; Fri, 05 Nov 2021 03:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233113AbhKEKWx (ORCPT + 99 others); Fri, 5 Nov 2021 06:22:53 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:46302 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233099AbhKEKWv (ORCPT ); Fri, 5 Nov 2021 06:22:51 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-01 (Coremail) with SMTP id qwCowABHTwtDBYVhTOWdBg--.11856S2; Fri, 05 Nov 2021 18:19:47 +0800 (CST) From: Jiasheng Jiang 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 Subject: [PATCH] net: qed: Fix the use of NULL pointer Date: Fri, 5 Nov 2021 10:19:46 +0000 Message-Id: <1636107586-3960637-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: qwCowABHTwtDBYVhTOWdBg--.11856S2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124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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