linux-stable/drivers/net/phy
Piergiorgio Beruto 1038bfb236 net: phy: fix use of uninit variable when setting PLCA config
Coverity reported the following:

*** CID 1530573:    (UNINIT)
drivers/net/phy/phy-c45.c:1036 in genphy_c45_plca_set_cfg()
1030     				return ret;
1031
1032     			val = ret;
1033     		}
1034
1035     		if (plca_cfg->node_cnt >= 0)
vvv     CID 1530573:    (UNINIT)
vvv     Using uninitialized value "val".
1036     			val = (val & ~MDIO_OATC14_PLCA_NCNT) |
1037     			      (plca_cfg->node_cnt << 8);
1038
1039     		if (plca_cfg->node_id >= 0)
1040     			val = (val & ~MDIO_OATC14_PLCA_ID) |
1041     			      (plca_cfg->node_id);
drivers/net/phy/phy-c45.c:1076 in genphy_c45_plca_set_cfg()
1070     				return ret;
1071
1072     			val = ret;
1073     		}
1074
1075     		if (plca_cfg->burst_cnt >= 0)
vvv     CID 1530573:    (UNINIT)
vvv     Using uninitialized value "val".
1076     			val = (val & ~MDIO_OATC14_PLCA_MAXBC) |
1077     			      (plca_cfg->burst_cnt << 8);
1078
1079     		if (plca_cfg->burst_tmr >= 0)
1080     			val = (val & ~MDIO_OATC14_PLCA_BTMR) |
1081     			      (plca_cfg->burst_tmr);

This is not actually creating a real problem because the path leading to
'val' being used uninitialized will eventually override the full content
of that variable before actually using it for writing the register.
However, the fix is simple and comes at basically no cost.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Fixes: 493323416f ("drivers/net/phy: add helpers to get/set PLCA configuration")
Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/f22f1864165a8dbac8b7a2277f341bc8e7a7b70d.1674056765.git.piergiorgio.beruto@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-01-19 19:12:13 -08:00
..
mscc net: phy: mscc: macsec: do not copy encryption keys 2022-11-18 09:17:42 +00:00
adin1100.c net: phy: adin1100: add PHY IDs of adin1110/adin2111 2022-09-20 15:00:30 +02:00
adin.c net: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:07 -07:00
amd.c net: phy: amd: remove the use of .ack_interrupt() 2020-11-17 11:37:00 -08:00
aquantia_hwmon.c
aquantia_main.c net: phy: aquantia: add AQR112 and AQR412 PHY IDs 2022-11-15 20:34:27 -08:00
aquantia.h
at803x.c Random number generator updates for Linux 6.2-rc1. 2022-12-12 16:22:22 -08:00
ax88796b.c net: phy: ax88772a: fix lost pause advertisement configuration 2022-06-29 20:39:05 -07:00
bcm7xxx.c net: phy: bcm7xxx: Add EPHY entry for 7712 2021-10-24 13:42:28 +01:00
bcm63xx.c net: phy: broadcom: remove use of ack_interrupt() 2020-11-05 16:32:39 -08:00
bcm87xx.c net: phy: bcm87xx: Use mmd helpers 2022-05-02 13:21:38 +02:00
bcm54140.c net: phy: broadcom: remove use of ack_interrupt() 2020-11-05 16:32:39 -08:00
bcm84881.c
bcm-cygnus.c net: phy: broadcom: remove use of ack_interrupt() 2020-11-05 16:32:39 -08:00
bcm-phy-lib.c net: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:07 -07:00
bcm-phy-lib.h net: phy: broadcom: Add Broadcom PTP hooks to bcm-phy-lib 2022-06-23 20:49:02 -07:00
bcm-phy-ptp.c net: phy: Add support for 1PPS out and external timestamps 2022-06-23 20:49:02 -07:00
broadcom.c net: phy: broadcom: Implement suspend/resume for AC131 and BCM5241 2022-08-17 11:49:23 +01:00
cicada.c net: phy: cicada: remove the use of .ack_interrupt() 2020-11-05 16:32:39 -08:00
cortina.c net: mdiobus: add clause 45 mdiobus accessors 2020-05-26 15:31:45 -07:00
davicom.c net: phy: fix space alignment issues 2021-06-16 12:34:07 -07:00
dp83tc811.c net: phy: ti: take into account all possible interrupt sources 2021-03-01 11:46:55 -08:00
dp83td510.c net: phy: dp83td510: add SQI support 2022-06-21 22:01:14 -07:00
dp83640_reg.h ptp: dp83640: don't define PAGE0 2021-09-14 20:03:24 -07:00
dp83640.c dp83640: Use generic ptp_msg_is_sync() function 2022-03-07 11:31:34 +00:00
dp83822.c net: dp83822: Print the SOR1 strap status 2022-10-27 12:48:53 +02:00
dp83848.c net: phy: ti: remove the use of .ack_interrupt() 2020-11-25 11:18:38 -08:00
dp83867.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
dp83869.c net: phy: add support for TI DP83561-SP phy 2021-11-19 20:13:07 -08:00
et1011c.c net: phy: remove unnecessary line continuation 2021-06-16 12:34:07 -07:00
fixed_phy.c net: phy: fixed_phy: set phy_mask before calling mdiobus_register() 2022-06-13 23:11:24 -07:00
icplus.c net: phy: icplus: call phy_restore_page() when phy_select_page() fails 2021-02-22 18:47:48 -08:00
intel-xway.c net: phy: intel-xway: Add RGMII internal delay configuration 2021-07-20 07:23:16 -07:00
Kconfig drivers/net/phy: add driver for the onsemi NCN26000 10BASE-T1S PHY 2023-01-11 08:35:03 +00:00
linkmode.c
lxt.c net: phy: correct format of block comments 2021-06-16 12:34:07 -07:00
Makefile drivers/net/phy: add driver for the onsemi NCN26000 10BASE-T1S PHY 2023-01-11 08:35:03 +00:00
marvell10g.c net: phy: marvell10g: select host interface configuration 2022-10-03 11:08:32 +01:00
marvell-88x2222.c net: sfp: augment SFP parsing with phy_interface_t bitmap 2022-10-03 11:08:32 +01:00
marvell.c net: phy: marvell: add sleep time after enabling the loopback bit 2022-11-15 13:14:46 +01:00
mdio_bus.c net: mdio: scan bus based on bus capabilities for C22 and C45 2023-01-19 16:23:19 +01:00
mdio_device.c net: mdio: fix unbalanced fwnode reference count in mdio_device_release() 2022-12-06 12:50:00 +01:00
mdio_devres.c of: mdio: provide devm_of_mdiobus_register() 2020-06-30 15:57:34 -07:00
mdio-boardinfo.c net: phy: Correct function name mdiobus_register_board_info() in comment 2021-03-29 13:42:44 -07:00
mdio-boardinfo.h
mdio-open-alliance.h drivers/net/phy: add helpers to get/set PLCA configuration 2023-01-11 08:35:02 +00:00
mediatek-ge.c net: phy: mediatek: remove PHY mode check on MT7531 2022-02-15 14:21:01 +00:00
meson-gxl.c Revert "net: phy: meson-gxl: improve link-up behavior" 2022-09-01 20:55:12 -07:00
micrel.c net: phy: micrel: Fix warn: passing zero to PTR_ERR 2023-01-09 07:21:42 +00:00
microchip_t1.c net: phy: lan87xx: change interrupt src of link_up to comm_ready 2022-09-08 11:02:44 +02:00
microchip.c net: phy: microchip: add comments for the modified LAN88xx phy ID mask. 2022-05-10 18:57:14 -07:00
mii_timestamper.c net: mii_timestamper: check NULL in unregister_mii_timestamper() 2021-06-11 13:08:52 -07:00
motorcomm.c net: phy: add Motorcomm YT8531S phy id. 2022-11-25 07:54:52 +00:00
mxl-gpy.c net: phy: mxl-gpy: disable interrupts on GPY215 by default 2023-01-10 13:38:37 +01:00
national.c net: phy: correct format of block comments 2021-06-16 12:34:07 -07:00
ncn26000.c drivers/net/phy: add driver for the onsemi NCN26000 10BASE-T1S PHY 2023-01-11 08:35:03 +00:00
nxp-c45-tja11xx.c net: phy: Use netif_rx(). 2022-03-06 11:05:31 +00:00
nxp-tja11xx.c net: phy: tja11xx: add interface mode and RMII REF_CLK support 2022-08-23 17:43:28 -07:00
phy_device.c net: phy: Decide on C45 capabilities based on presence of method 2023-01-19 16:23:19 +01:00
phy_led_triggers.c net: phy: leds: Deduplicate link LED trigger registration 2020-10-30 10:43:37 -07:00
phy-c45.c net: phy: fix use of uninit variable when setting PLCA config 2023-01-19 19:12:13 -08:00
phy-core.c drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY 2023-01-11 08:35:02 +00:00
phy.c drivers/net/phy: add connection between ethtool and phylib for PLCA 2023-01-11 08:35:02 +00:00
phylink.c drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY 2023-01-11 08:35:02 +00:00
qsemi.c net: phy: change format of some declarations 2021-06-16 12:34:07 -07:00
realtek.c net: phy: realtek: add support for RTL8211F(D)(I)-VD-CG 2022-08-22 12:47:18 +01:00
rockchip.c net: phy: Demote non-compliant kernel-doc headers 2021-05-17 14:12:39 -07:00
sfp-bus.c net: sfp: fill also 5gbase-r and 25gbase-r modes in sfp_parse_support() 2022-10-10 18:00:29 -07:00
sfp.c net: sfp: remove unused ctype.h include 2023-01-19 18:55:31 -08:00
sfp.h net: sfp: augment SFP parsing with phy_interface_t bitmap 2022-10-03 11:08:32 +01:00
smsc.c net: phy: smsc: use device-managed clock API 2022-08-31 12:19:18 -07:00
spi_ks8995.c net: phy: spi_ks8895: switch to using gpiod API 2022-09-15 11:43:51 +02:00
ste10Xp.c net: phy: fix space alignment issues 2021-06-16 12:34:07 -07:00
swphy.c
swphy.h
teranetics.c
uPD60620.c
vitesse.c net: phy: correct format of block comments 2021-06-16 12:34:07 -07:00
xilinx_gmii2rgmii.c net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe 2022-12-30 07:46:10 +00:00