Thread (42 messages) flat view 42 messages, 4 authors, 2d ago

Re: [PATCH net-next v11 12/15] ax88179_178a: Add ethtool get_drvinfo

From: netdev-bot+sashiko@kernel.org
Date: 2026-09-16 06:47:37
Also in: linux-usb, lkml

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 0 · Low: 2

- [Low] ax88179a_get_drvinfo()
  (drivers/net/usb/ax88179a_devices.c:221-233) exports a four-component…
- [Low] Failed bootloader register reads are exported to userspace as a
  genuine firmware version.

--

ax88179_178a: Add ethtool get_drvinfo

This adds ax88179a_get_drvinfo() as the get_drvinfo implementation for
ax88179a_ethtool_ops.  It calls usbnet_get_drvinfo() first and then, for
chips at least as new as AX_VERSION_AX88179A, overwrites
info->fw_version with the four bytes cached in priv->fw_version.
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/usb/ax88179a_devices.c b/drivers/net/usb/ax88179a_devices.c
index 27836c72ec14a..817d542c4cc08 100644
--- a/drivers/net/usb/ax88179a_devices.c
+++ b/drivers/net/usb/ax88179a_devices.c
@@ -218,6 +218,20 @@ static int ax88179a_resume(struct usb_interface *intf)
 	return usbnet_resume(intf);
 }
 
+static void ax88179a_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
+{
+	struct ax88179_data *priv = netdev2data(net);
+
+	/* Inherit standard device info */
+	usbnet_get_drvinfo(net, info);
+	if (priv->chip_version < AX_VERSION_AX88179A)
+		return;
+
[Severity: Low]
Should a failed bootloader read be reported as a real firmware revision
here?

In ax88179a_bind(), a failing ax88179_read_cmd() on AX88179A_ACCESS_BL
stores a sentinel and binding continues:

	for (int i = 0; i < 3; i++) {
		ret = ax88179_read_cmd(dev, AX88179A_ACCESS_BL, (0xFD + i),
				       1, 1, &ax179_data->fw_version[i]);
		if (ret < 0)
			ax179_data->fw_version[i] = 0xff;
	}

No validity flag is kept, and ax88179a_get_drvinfo() only gates on
priv->chip_version before overwriting the string that
usbnet_get_drvinfo() filled from dev->driver_info->description:

	strscpy(info->fw_version, dev->driver_info->description,
		sizeof(info->fw_version));

So after a transient control-transfer error on registers 0xFD..0xFF,
ethtool -i prints firmware "255.255.255.0" rather than falling back to
the description string.  Would tracking a "firmware version unknown"
state in ax88179a_bind() and skipping the snprintf() in that case be
preferable?
+	snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d.%d",
+		 priv->fw_version[0], priv->fw_version[1],
+		 priv->fw_version[2], priv->fw_version[3]);
+}
+
[Severity: Low]
Where does the fourth component of this version string come from?

The only producer of priv->fw_version[] is ax88179a_bind(), and its loop
only reads three bootloader registers:

	for (int i = 0; i < 3; i++) {
		ret = ax88179_read_cmd(dev, AX88179A_ACCESS_BL, (0xFD + i),
				       1, 1, &ax179_data->fw_version[i]);

struct ax88179_data is allocated with kzalloc_obj(*ax179_data) in the
same function, and u8 fw_version[4] in ax88179_lib.h has no other writer
in drivers/net/usb/, so fw_version[3] stays 0 forever.

That makes ethtool -i always report a trailing ".0" that the device never
supplied.  Is the read loop short by one register, or should the format
string be "%d.%d.%d"?
 static void ax88179a_bulkin_config(struct usbnet *dev, u8 link_sts, u8 speed, bool full_duplex)
 {
 	struct ax88179_data *ax179_data = dev->driver_priv;
[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260914-ax88179a-v11-0-5ea7a925ba6d%40birger-koblitz.de
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help