From patchwork Sat Feb 3 15:03:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Sakharov X-Patchwork-Id: 196316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp1059324dyc; Sat, 3 Feb 2024 07:04:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNe8GZVmdgvC1pkr5WsZ9A1ziwfigZfof0/Pd2fIm0YRg60YevQiGOQdShCUYXnoX35V1k X-Received: by 2002:a4a:bd86:0:b0:599:c1cf:ea6d with SMTP id k6-20020a4abd86000000b00599c1cfea6dmr4519718oop.1.1706972676560; Sat, 03 Feb 2024 07:04:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706972676; cv=pass; d=google.com; s=arc-20160816; b=Mnxe4FcelOccYmMYD9V6MfSdmM0paTtgmBNO7QcLq6YA/XupNc+z8OH2NffltrN1Gn KGbhl5GOpxY3zkf1BFENzzNwFQnDajIuFfoI1pOkHtw6gv4rJybykQHN0N+7Mp6GYg/A FYF9Z92SSQuRr+JomuUinz5JKXQNfwmOSxUnGmiIceNlRWDKnt21y1w/I80s5xuU1db7 eoPAfuefVDHCBueCF/iHXtsO5q0ZOXk22Lxgzj8rBbyN6Y4/+uU/iEU7W9vH5xCbWV9C ChHaaLK43KU2Pl7H/+OogFc53ofJ9WHZKpw8ZqcE9okz2PrMQutnwZfx5IeVNUVtKlBz rK4A== 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:dkim-signature:dkim-filter; bh=LWaLolZLVHoMja/NNNmsmRp6PTzwtZ8CVFd3EvB8tPA=; fh=J5d9wGbU2UTz7GO9L94xGcO+UjD3UEcWtk/tgPM73yU=; b=lfoS1s5PYrGOuwpBL4px6CRUVFwwxVMqHzwqriJJ9j4DYHErp4+QhLxXpNec+AxY83 /smayGTVsn5Tb3n+aVkfhyVlHISZfvu5Pl2hXF2R8Z/rxKBS1X6/M65frNrd3P3Y/2gD cgnxPzCEdXUJmbStYHq+CNpCqTWEEHoB8O0lm3nJjGST/KjL9ACHG9/AFo1+u+ZxWm9h Y972zic2Gw4WgFWVcmIlhLA/smriPOH0ffOMQVSxQNJOwWESRp+uK9e2x2YMOupWnab9 AMShkPxwIjnA+4kh0r9LQ7wSVLVU8JgpKhrGieynlIHdsd4gGA5XT3/EQKXTbnC2ReeM So1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=C3eu6XJy; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-51135-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru X-Forwarded-Encrypted: i=1; AJvYcCWt3Sc1bO8UQHf5a/4cEtDkVGLSY6GA9N5HYwoqjTrHNs3ZjI7QcbG4FE/2W/JELxHUDGQd4JU9dc1E6qeXPExkwV/DZQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e11-20020a67fb4b000000b0046b1477764bsi579217vsr.65.2024.02.03.07.04.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 07:04:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51135-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=C3eu6XJy; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-51135-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 506EA1C21700 for ; Sat, 3 Feb 2024 15:04:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 654035F54C; Sat, 3 Feb 2024 15:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="C3eu6XJy" Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 594F95EE86; Sat, 3 Feb 2024 15:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706972656; cv=none; b=U1jGYaMk1xpYOrtVnGQpbccdcLxkyEHx+bYnLoMc/857t0KJ2IkIdXHUblRE0X1myTwULXfPRvqgSUPr6RPj4tWjGpOk/iG2WEKacwSeePofCuAhG8DxoOPTMeQFPQ6rjQKb9dJYsqlholcSBIB+cE5JuUz6QRXkxht76HPZExk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706972656; c=relaxed/simple; bh=2GLWDPQIEiSm6KySEb3j7J+GjSJV+EXcOoENDX6iZHA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=m3qxAu4zhj8IN4ohUJ5X9sU8Y6D00wM7H9FZfp8fb/9c2p9/Tgb5wPrrFua3sLWwNAJ1qUttS726t9CBDCGb1z2BZUMpsalwR5lkqKMnEkLE26RukwONrbPTzG0G3KqU564tb8GbMQs84xMRrkbQRXqOlGXkHnPpReti2QxcHYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=C3eu6XJy; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Received: from localhost.localdomain (unknown [85.89.126.105]) by mail.ispras.ru (Postfix) with ESMTPSA id 1D2E440F1DC6; Sat, 3 Feb 2024 15:04:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 1D2E440F1DC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1706972644; bh=LWaLolZLVHoMja/NNNmsmRp6PTzwtZ8CVFd3EvB8tPA=; h=From:To:Cc:Subject:Date:From; b=C3eu6XJyaDUjR+G0C86mQ6ZfmK67QE9aFBH75t4eJo3MG0wzROpenuGRldhsUG4ya bJDGjp7dsn6YzyhElq58earXsrx1xa1OQfmp3tZa4EUTtBonJaKLW5gkzcCyWyzWIl +ryFZYP87zIgqKq665ykwGQdkm19rjtYVL7cCh9w= From: Pavel Sakharov To: Alexandre Torgue Cc: Pavel Sakharov , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Alexey Khoroshilov Subject: [PATCH] stmmac: Fix incorrect dereference in stmmac_*_interrupt() Date: Sat, 3 Feb 2024 18:03:21 +0300 Message-ID: <20240203150323.1041736-1-p.sakharov@ispras.ru> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789890580862448119 X-GMAIL-MSGID: 1789890580862448119 If 'dev' is NULL, the 'priv' variable has an incorrect address when dereferencing calling netdev_err(). Pass 'dev' instead of 'priv->dev" to the function. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Pavel Sakharov --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4727f7be4f86..5ab5148013cd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5848,7 +5848,7 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id) struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { - netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); + netdev_err(dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } @@ -5868,7 +5868,7 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id) struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { - netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); + netdev_err(dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; }