Module Name: src
Committed By: jmcneill
Date: Sun Jan 11 14:19:09 UTC 2015
Modified Files:
src/sys/dev/usb: if_urtwn.c
Log Message:
Pass the correct length to firmware_free. The code previously did
len = firmware_get_size(..) and then used len as a counter while loading
firmware. The result was that in the success path, len = 0. This commit
introduces a new "fwlen" (const) to store the firmware size, and passes it
to firmware_free instead of "len".
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_urtwn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.35 src/sys/dev/usb/if_urtwn.c:1.36
--- src/sys/dev/usb/if_urtwn.c:1.35 Wed Jan 7 07:05:48 2015
+++ src/sys/dev/usb/if_urtwn.c Sun Jan 11 14:19:09 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.35 2015/01/07 07:05:48 ozaki-r Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.36 2015/01/11 14:19:09 jmcneill Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.20 2011/11/26 06:39:33 ckuethe Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.35 2015/01/07 07:05:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.36 2015/01/11 14:19:09 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3072,7 +3072,7 @@ urtwn_load_firmware(struct urtwn_softc *
error);
return (error);
}
- len = firmware_get_size(fwh);
+ const size_t fwlen = len = firmware_get_size(fwh);
fw = firmware_malloc(len);
if (fw == NULL) {
aprint_error_dev(sc->sc_dev,
@@ -3085,7 +3085,7 @@ urtwn_load_firmware(struct urtwn_softc *
if (error != 0) {
aprint_error_dev(sc->sc_dev,
"failed to read firmware (error %d)\n", error);
- firmware_free(fw, len);
+ firmware_free(fw, fwlen);
return (error);
}
@@ -3175,7 +3175,7 @@ urtwn_load_firmware(struct urtwn_softc *
goto fail;
}
fail:
- firmware_free(fw, len);
+ firmware_free(fw, fwlen);
return (error);
}