Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp53874lqr; Tue, 4 Jun 2024 20:58:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpct9StEXBgot8RTL1AjLrC5TwSzJA6H+hL/oNHp8bduFd9/ZV/LpOP1u2qiVQZB5crCS7QOuuaZSPwKIqLGd0qbhDaNFjhmul24qcOA== X-Google-Smtp-Source: AGHT+IGPm3Xax/yXzS5km8Xd/0FqFOQlLj9rgostLE09Elb/hc/Q4cD4E2cofSNJUD3Ijabq7Jzv X-Received: by 2002:a05:6512:3498:b0:52b:8363:34ef with SMTP id 2adb3069b0e04-52bab4d1583mr652820e87.15.1717559915368; Tue, 04 Jun 2024 20:58:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717559915; cv=pass; d=google.com; s=arc-20160816; b=sp6KuK5+xM+gBRmvf0VXy8y9AXYIb8KVsYVrNA2HSPSh2mh9ozN1hD/9FxprSfofij bE9023Pw7sNcqSLcSSqkAKSIHI2+uyIyQPD+pB8N7Y2eUMH/8QTL15qvzLSHCDVOGZWq d+GbFmT3aBzPlKhfoDo6se8lKnohNswo14KQTAG0xkAB7p2Hycxdb7Oth61JTNU2f99F OwLMlXqdT5YdRVA1dr8wRA0i6f0R4yzdV9akHvF5ljzqLkLROdpQsQnC95u4F+11eQP4 go0hHqZyBBkYjikC0tyP4F1yNyX9f3sL2gy1C4s//LoAonKJfSeN3XEB7T3UaYhphYIo UvaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=qj3NdaQWWwmsyf/2ss3nazvNVel/O6l91EAb+nJw6oE=; fh=v0o6voTIGXzMNQC60AeyTRm6tRmSQxEwDtQLuGdGVbE=; b=VVqnWrqlTZsasEsjKPlpPM4G6Oi98PVylSpZdyf4GcKFjlIEEe1mdlKUhBCFhRUi2m c5+QN3mdS1ALy/mw8FaGtMMUoAAt9O7cpZiSo74jgyYoT5y3zLqOgBtLqzpC4TRxD+E6 DGxrYodPKW8W4WBCtG+n3NblUC/fCuKtZFfbfCOUeiT4tJk4ave5gHZJ7+rRLP0/IERe Fjx2gy60IEHJDG3WoIAxjfDFtDZDsSiD01f0kVz+Rb/WO5fBTzKhmCJ5NndDrSR4fm96 0/NZ1AIhCv5ibQT2ApFB80tEKXTEEk2lZuetXVKyzFzEG3ZCPgIGG6qOD7d06AAli0iy guUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-201731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201731-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68f23dfde7si333046766b.20.2024.06.04.20.58.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 20:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-kernel+bounces-201731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201731-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EA2BA1F2617A for ; Wed, 5 Jun 2024 03:48:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED39E136E1F; Wed, 5 Jun 2024 03:48:14 +0000 (UTC) Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 8060D433A9; Wed, 5 Jun 2024 03:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717559294; cv=none; b=AYin4x6FZcz3aBMdU/xVxW8xKs4D+TH4/6HcZozRpUQLrf4lEE59rvkq1bH/ZnbTZTifUizqmJVscCjvwpygTjyt4gxvE5g+sdTyBsIO5gtRvY4uKqduGqIO9lnsElk7j6itTEsSbqQIWzjXxjoGSMWlk3tkg0e71DMdU3qxdgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717559294; c=relaxed/simple; bh=j9OA7Ub6TkUxBfDMSbmGIFCbyIPwZ6CydduLEsssUFQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DrX08dNFSzM4Edj6b7RtyOqmJLeCrzX+vYFUEIbj9mY4LMMx/3s6lDPdDrxYS1KbrM88Xu2EXLDr+hhsLKww8JVumWhU1uB3eJ8te4M7FjbbPES5067cQue3kdwtIhAvwLFAHBiP4YIWWVJQjFkH5tN6VntWK7eVpXiNmwBY7S4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id F1F5360189A89; Wed, 5 Jun 2024 11:47:46 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com Cc: Su Hui , andrew@lunn.ch, ahmed.zaki@intel.com, hkallweit1@gmail.com, justin.chen@broadcom.com, jdamato@fastly.com, gerhard@engleder-embedded.com, d-tatianin@yandex-team.ru, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() Date: Wed, 5 Jun 2024 11:47:43 +0800 Message-Id: <20240605034742.921751-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Clang static checker (scan-build) warning: net/ethtool/ioctl.c:line 2233, column 2 Called function pointer is null (null dereference). Return '-EOPNOTSUPP' when 'ops->get_ethtool_phy_stats' is NULL to fix this typo error. Fixes: 201ed315f967 ("net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers") Signed-off-by: Su Hui --- net/ethtool/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 5a55270aa86e..e645d751a5e8 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2220,7 +2220,7 @@ static int ethtool_get_phy_stats_ethtool(struct net_device *dev, const struct ethtool_ops *ops = dev->ethtool_ops; int n_stats, ret; - if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats) + if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats) return -EOPNOTSUPP; n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS); -- 2.30.2