Thread (9 messages) 9 messages, 2 authors, 2011-06-17

Re: [PATCH net-next 2/4] r8169: explicit firmware format check.

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2011-06-17 22:24:03

Ben Hutchings [off-list ref] :
[...]
quoted
@@ -1230,7 +1239,7 @@ static void rtl8169_get_drvinfo(struct net_device *dev,
 	strcpy(info->version, RTL8169_VERSION);
 	strcpy(info->bus_info, pci_name(tp->pci_dev));
 	strncpy(info->fw_version, IS_ERR_OR_NULL(rtl_fw) ? "N/A" :
-		rtl_lookup_firmware_name(tp), sizeof(info->fw_version) - 1);
+		rtl_fw->version, RTL_VER_SIZE);
You appear to ensure that rtl_fw->version is properly terminated, so I
would suggest:

	BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version));
	strcpy(info->fw_version, IS_ERR_OR_NULL(rtl_fw) ? "N/A" : rtl_fw->version);
Ok.

[...]
quoted
+	if (!(fw->size % FW_OPCODE_SIZE)) {
+		snprintf(rtl_fw->version, RTL_VER_SIZE, "%s",
+			 rtl_lookup_firmware_name(tp));
strlcpy()
Ok.

[...]
This function is doing rather more than what its name suggests.  And it
always returns true, so it doesn't actually do what its name suggests at
all.
No idea for a short better name. Will fix the return part.

-- 
Ueimor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help