]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rocker: fix link status detection in rocker_carrier_init()
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 14 Nov 2024 15:19:46 +0000 (18:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:40 +0000 (19:51 +0100)
[ Upstream commit e64285ff41bb7a934bd815bd38f31119be62ac37 ]

Since '1 << rocker_port->pport' may be undefined for port >= 32,
cast the left operand to 'unsigned long long' like it's done in
'rocker_port_set_enable()' above. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20241114151946.519047-1-dmantipov@yandex.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/rocker/rocker_main.c

index 3364b6a56bd1eb465651be5e3a1021580ac8c0e9..e1509becb7536edcfcf65841df8076fb401c0ac0 100644 (file)
@@ -2516,7 +2516,7 @@ static void rocker_carrier_init(const struct rocker_port *rocker_port)
        u64 link_status = rocker_read64(rocker, PORT_PHYS_LINK_STATUS);
        bool link_up;
 
-       link_up = link_status & (1 << rocker_port->pport);
+       link_up = link_status & (1ULL << rocker_port->pport);
        if (link_up)
                netif_carrier_on(rocker_port->dev);
        else