From 4bf3f84ca23c4c1a470a7800e419f0cbe83f6ea6 Mon Sep 17 00:00:00 2001 From: Manish Bhardwaj Date: Wed, 13 Oct 2021 10:19:17 +0000 Subject: [PATCH] NVIDIA: SAUCE: net: phy: fix ubsan warning network layer BugLink: https://bugs.launchpad.net/bugs/2072591 Using this patch we are fixing ubsan warning in network driver layer. [ 3.807549] Call trace: [ 3.807550] dump_backtrace+0x/0x1e0 [ 3.807560] show_stack+0x2c/0x40 [ 3.807564] dump_stack+0xd8/0x138 [ 3.807570] ubsan_epilogue+0xc/0x4c [ 3.807572] __ubsan_handle_out_of_bounds+0x8c/0xb0 [ 3.807578] swphy_read_reg+0x388/0x590 [ 3.807581] fixed_mdio_read+0xc8/0x110 [ 3.807584] __mdiobus_read+0x40/0x1e0 [ 3.807585] mdiobus_read+0x40/0x60 [ 3.807586] get_phy_device+0x1b4/0x380 [ 3.807590] __fixed_phy_register.part.0+0x94/0x280 [ 3.807592] fixed_phy_register+0x64/0x90 [ 3.807594] of_phy_register_fixed_link+0x124/0x1b0 [ 3.80759] ether_probe+0x108c/0x38e0 [ 3.807603] platform_drv_probe+0x58/0xe0 [ 3.807607] really_probe+0x100/0x4f0 [ 3.807608] driver_probe_device+0xfc/0x180 [ 3.807610] device_driver_attach+0x74/0x80 [ 3.807612] __driver_attach+0xac/0x180 [ 3.807614] bus_for_each_dev+0x80/0xd0 [ 3.807617] driver_attach+0x30/0x40 [ 3.807619] bus_add_driver+0x16c/0x260 [ 3.807621] driver_register+0x64/0x110 [ 3.807623] __platform_driver_register+0x5c/0x70 [ 3.807625] nvethernet_driver_init+0x20/0x28 [ 3.807630] do_oneinitcall+0x50/0x370 [ 3.807632] kernel_init_freeable+0x350/0x3c8 [ 3.807635] kernel_init+0x20/0x128 http://nvbugs/4078213 Signed-off-by: Manish Bhardwaj Signed-off-by: Revanth Kumar Uppala Reviewed-by: Bibek Basu Tested-by: Abhilash G Reviewed-by: Abhilash G Reviewed-by: Laxman Dewangan Signed-off-by: Laxman Dewangan Acked-by: Jacob Martin Acked-by: Noah Wager Signed-off-by: Noah Wager --- drivers/net/phy/swphy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c index 6e946285fa0f..5380f952e846 100644 --- a/drivers/net/phy/swphy.c +++ b/drivers/net/phy/swphy.c @@ -54,6 +54,10 @@ static const struct swmii_regs speed[] = { .lpagb = LPA_1000FULL | LPA_1000HALF, .estat = ESTATUS_1000_TFULL | ESTATUS_1000_THALF, }, + [SWMII_SPEED_5000] = { + }, + [SWMII_SPEED_10000] = { + }, }; static const struct swmii_regs duplex[] = {