diff mbox series

rocker: fix link status detection in rocker_carrier_init()

Message ID 20241114151946.519047-1-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit e64285ff41bb7a934bd815bd38f31119be62ac37
Delegated to: Netdev Maintainers
Headers show
Series rocker: fix link status detection in rocker_carrier_init() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-15--21-00 (tests: 789)

Commit Message

Dmitry Antipov Nov. 14, 2024, 3:19 p.m. UTC
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>
---
 drivers/net/ethernet/rocker/rocker_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Nov. 19, 2024, 2:42 a.m. UTC | #1
On Thu, 14 Nov 2024 18:19:46 +0300 Dmitry Antipov wrote:
> 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.

Jiri, random thought - any sense if anyone still uses rocker?
IIUC the goal was similar to netdevsim - SW testing / modeling
but we don't really have any upstream tests against it..

Unrelated to the patch, so dropping the author from CC.
patchwork-bot+netdevbpf@kernel.org Nov. 19, 2024, 2:50 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 14 Nov 2024 18:19:46 +0300 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - rocker: fix link status detection in rocker_carrier_init()
    https://git.kernel.org/netdev/net-next/c/e64285ff41bb

You are awesome, thank you!
Jiri Pirko Nov. 19, 2024, 9:28 a.m. UTC | #3
Tue, Nov 19, 2024 at 03:42:01AM CET, kuba@kernel.org wrote:
>On Thu, 14 Nov 2024 18:19:46 +0300 Dmitry Antipov wrote:
>> 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.
>
>Jiri, random thought - any sense if anyone still uses rocker?
>IIUC the goal was similar to netdevsim - SW testing / modeling
>but we don't really have any upstream tests against it..

Afaik some people are still using it for testing. I got couple emails in
the past. Not sure now. The thing is, rocker has real datapath,
comparing to netdevsim.

>
>Unrelated to the patch, so dropping the author from CC.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 84fa911c78db..fe0bf1d3217a 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2502,7 +2502,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