Re: [net-next] r8152: Add 2500baseT EEE status/configuration support
From: Birger Koblitz <hidden>
Date: 2026-02-24 17:36:56
Also in:
linux-usb, lkml
Hi Simon, On 24/02/2026 6:02 pm, Simon Horman wrote:
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html --- r8152: Add 2500baseT EEE status/configuration support The r8152 driver supports the RTL8156, which is a 2.5Gbit Ethernet controller for USB 3.0, for which support is added for configuring and displaying the EEE advertisement status for 2.5GBit connections. The patch also corrects the determination of whether EEE is active to include the 2.5GBit connection status and make the determination dependent not on the desired speed configuration (tp->speed), but on the actual speed used by the controller.quoted
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 8d36162f36df..a831acd385cd 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c[ ... ]quoted
@@ -8924,6 +8926,7 @@ static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee) { __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u16 val; + u16 speed = rtl8152_get_speed(tp);Simon says: please declare local variables in reverse xmas tree order - longest line to shortest.
Will fix in v2.
Does this code read uninitialized memory? The 'common' bitmap is declared via __ETHTOOL_DECLARE_LINK_MODE_MASK(common), which expands to DECLARE_BITMAP -- an uninitialized stack array:
I will fix this in v2 by initializing common to an empty bitmask.
[Simon says: I note that Daniel Golle flagged this issue already]
This was forgotten in the edited patch and will be part of v2.
The same uninitialized memory issue exists here in r8153_get_eee. The 'common' bitmap declared via __ETHTOOL_DECLARE_LINK_MODE_MASK is never zeroed before individual speed bits are conditionally set with linkmode_set_bit(). Then linkmode_and() reads the uninitialized garbage bits. This function affects RTL_VER_03 through RTL_VER_15, which is the majority of supported devices.
I will fix this in v2. Birger