Bug 12397

Summary: function stir421x_patch_device can't upload firmware
Product: Networking Reporter: Jose-Vicente Gilabert (josevteg)
Component: WirelessAssignee: Samuel Ortiz (samuel)
Status: CLOSED CODE_FIX    
Severity: normal CC: samuel
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27 Subsystem:
Regression: --- Bisected commit-id:

Description Jose-Vicente Gilabert 2009-01-10 01:16:23 UTC
The problem is a variable defined as char[11] to keep the name of the firmware file which is always 11 chars long.
It should be a char[12] to fit the trailing "\0".

Patch:
--- irda-usb.c.wrong	2009-01-10 09:50:49.000000000 +0100
+++ irda-usb.c.ok	2009-01-10 09:50:12.000000000 +0100
@@ -1075,7 +1075,7 @@
 {
 	unsigned int i;
 	int ret;
-	char stir421x_fw_name[11];
+	char stir421x_fw_name[12];
 	const struct firmware *fw;
 	const unsigned char *fw_version_ptr; /* pointer to version string */
 	unsigned long fw_version = 0;

The assignment to stir421x_fw_name is made one line later:
        /*
         * Known firmware patch file names for STIR421x dongles
         * are "42101001.sb" or "42101002.sb"
         */
        sprintf(stir421x_fw_name, "4210%4X.sb",
                self->usbdev->descriptor.bcdDevice);
        ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev);

This function has been working through several versions of the kernel but it started to fail after my last ubuntu upgrade.

???