Skip to contentSkip to conversation

firmware_helper.c: correct amount uploaded

PATCH In review Duncan Sands 3 participants 4 messages Sep 9, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware_helper.c: correct amount uploaded

Uploading more than the buffer holds is not a good idea...

extras/firmware/firmware_helper.c renamed from extras/firmware/firmware_helper.c.orig +1 -1
@@ -120,7 +120,7 @@
 	while (count < fw_buffer_size) {
 		int c;
 
-		c = write(fw_fd, fw_buffer+count, fw_buffer_size);
+		c = write(fw_fd, fw_buffer+count, fw_buffer_size-count);
 		if (c <= 0) {
 			rc = errno;
 			close(fw_fd);

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 1 line · Duncan Sands

Uploading more than the buffer holds is not a good idea...

Yeah, I messed it up. Thanks for the fix.

Kay

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Duncan Sands
Quoted 1 line · Duncan Sands

Uploading more than the buffer holds is not a good idea...

Great, it fixes firmware upload for ipw2200 drivers (in monitor mode). Thanks a lot!

Signature · 14 lines
Olivier Blin
Mandriva



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Duncan Sands
Quoted 3 lines
Quoted 1 line

Uploading more than the buffer holds is not a good idea...

Great, it fixes firmware upload for ipw2200 drivers (in monitor mode).

It also fixes firmware upload for speedtch revision 4 modems (problem reported by Andrew Benton, who helped me track it down - thanks Andrew!). In practice the result of this bug was that the amount uploaded was the size of the firmware rounded up to the nearest multiple of the page size (due to the interaction between the bug and the fact that the firmware class only takes one page at a time), though only if the original size was at least one page. So small firmware blobs, or firmware which was a multiple of the page size uploaded OK, which was confusing.

Quoted 1 line

Thanks a lot!

No problem,

Duncan.

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel