Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2404745lqp; Sun, 24 Mar 2024 18:08:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNOHdA3+MttK+O8jL5IVnTz0e3P7hFkzMiCaR5Q3/rUxwKB7r0+SgoQWirkqbtNp1dTDRc7eS3EJOCBXk4guvNlQelVh+Rh7qs3IXCHQ== X-Google-Smtp-Source: AGHT+IHpfpiaELL5vQ1rMiB/EjNOqKe7VeYX7hPLVM+DSyO3vBdpbAyh7/Ml0gkcXmPv9NVaiats X-Received: by 2002:a05:6870:1711:b0:221:ca43:604e with SMTP id h17-20020a056870171100b00221ca43604emr5692934oae.53.1711328882744; Sun, 24 Mar 2024 18:08:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328882; cv=pass; d=google.com; s=arc-20160816; b=0Mrq1cUenIjAnb0sQEv3NwZreiC9leBKv/asF41gJ0OHdqbSAw4adKKdnwW+ViVBJK IZIzoljI4v3WL1RWF13jN3fpRrumxRGXTJ9QI8Nn7fr+EabCdIUBM/gVx6+skWnunMAW wAktkqnZJTX0XsrD3xVOJXKLA2o/0W1l4Tor1ZdhB1+yT8gT0Nr3l6/sdxN0ZILSerHj sFKqGLRbfe5QKahrIAcY0cRKINEGYFOyR1+GD4B9/RxzXAY/vzfVKITgETibCI1YRTyo nL1LGbXZS0wPflVz+ulRKgk6y6gWIqc5wz4oL2NZgE6svLxxMdRUL7vn+S5kw4W6u0W7 Qyvg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Wu3/ryznCRQ3qdp6Cu5GH4Hf235M/5am3Ky7JAIiVWo=; fh=LUfT5FOPoYqUIhs1EEkmMAaByEnuXSarnOPUGsvo0I0=; b=aEYKIjNrzW8ZKtgG146p2/gv9usc2ZR6ljPkxxX8/d7V6yQUOJ45RAPBrgUzxaH0GV a/v7VuMNLIHlxyopmuVhsSxs5VgqGvxzz0enR8eJ83iMi+HPgmAfYX3tJ7ba7/1BxTlP yAGhx2vOjEajjwOmywoxH8sewTmRIQo3/cijwTnoR4vTa3oGTyRrA5rZldwCg7q08a/O ax4jWV9riVoIVMN7Zx5lL42Iqf8CzYI/Pzs4+Hq2Xh61KY/hsryj0LwClnV4aZXWiHcI GXoG16x54jJNrOyodNXjLraUpWXswfK1ImPVcDDR1O5gFeQ2bTDtpwNxpSk8iyo4b+jJ XKYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WtHuS9SE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b1-20020aa78101000000b006e688f7b061si4077440pfi.270.2024.03.24.18.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WtHuS9SE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 62E41283C44 for ; Mon, 25 Mar 2024 01:08:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C72C51C9EAD; Sun, 24 Mar 2024 22:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WtHuS9SE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB7DE1C987B; Sun, 24 Mar 2024 22:46:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320382; cv=none; b=eDQhcRBdq8OD8jeiSe2VyhTz6CXh6F/tohSl/cmfaz/WFeUQFbLac4O339spWpVhn7NE8Sp1i1rMYV+PhV6HxaVlv+a+aUwnOgNyPVYQjO+b+s931wehvHNoaPXqgvkQDZNxs6VMUkEgSrnxZYGj5M28EEBG+g+PiUS9UF5sxkE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320382; c=relaxed/simple; bh=/kJ+pL9TYq+r6hMSprRXe861dYBO4v98N/ell1FcD9g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HIwFUWx9k1pB/x2kPbiTuW1m/pfJTWEzwqB3BudwoDkRg/apH31h5MMkWfzx9ltoXYLRG5FTKJLjVEjOzITeOQyn5CHVaka3IDVnsFjTsqlz0pf6emil98QvCdA4pvkL7jrxtvX4u0Rb+m/DQp97hhUdUYkvIidopWRvDJmoDpY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WtHuS9SE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07B28C433C7; Sun, 24 Mar 2024 22:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320382; bh=/kJ+pL9TYq+r6hMSprRXe861dYBO4v98N/ell1FcD9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WtHuS9SEQ8U0DorYuYEDE7YKVnEgGs7JoqDF7Z+9NN5GuHvX8H/DnO0lK/bn+OpiW LPuZ9bj90qTNsAO+ikp5dXo9s7yamjaX4Z5FUfl1ZB1FwNhCSKisqqc5M3fz87ofoG k2NHoIibdzrW4Lsv1nsQhp+nncxzJ1BYM0gItDvbZOVqYw4zJCTucV3d0RYPsAHj2T UzJxXLqlqUeYomBrwwYQgUFbE66WTc2A/2SA/NRFUcb/JmNFCd+dvJlPffgfV4JORJ quIN2tjAJdwoaEGdvOrabGQcijoxQulFDJADqQi5qCiyf4r8s9B9Y607p/hz/9C1vf 8t2GQxjRMxdrA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nikita Kiryushin , Russell King , Paolo Abeni , Sasha Levin Subject: [PATCH 6.8 688/715] net: phy: fix phy_read_poll_timeout argument type in genphy_loopback Date: Sun, 24 Mar 2024 18:34:27 -0400 Message-ID: <20240324223455.1342824-689-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Nikita Kiryushin [ Upstream commit 32fa4366cc4da1c97b725a0066adf43c6b298f37 ] read_poll_timeout inside phy_read_poll_timeout can set val negative in some cases (for example, __mdiobus_read inside phy_read can return -EOPNOTSUPP). Supposedly, commit 4ec732951702 ("net: phylib: fix phy_read*_poll_timeout()") should fix problems with wrong-signed vals, but I do not see how as val is sent to phy_read as is and __val = phy_read (not val) is checked for sign. Change val type for signed to allow better error handling as done in other phy_read_poll_timeout callers. This will not fix any error handling by itself, but allows, for example, to modify cond with appropriate sign check or check resulting val separately. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configuration") Signed-off-by: Nikita Kiryushin Reviewed-by: Russell King (Oracle) Link: https://lore.kernel.org/r/20240315175052.8049-1-kiryushin@ancud.ru Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 3ad9bbf65cbeb..6125418ca93f3 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2706,8 +2706,8 @@ EXPORT_SYMBOL(genphy_resume); int genphy_loopback(struct phy_device *phydev, bool enable) { if (enable) { - u16 val, ctl = BMCR_LOOPBACK; - int ret; + u16 ctl = BMCR_LOOPBACK; + int ret, val; ctl |= mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); -- 2.43.0