Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Avoid kmem_free(NULL) in iwm_read_firmware()
details: https://anonhg.NetBSD.org/src/rev/9456347ab1ee
branches: trunk
changeset: 336584:9456347ab1ee
user: khorben <khorben%NetBSD.org@localhost>
date: Sat Mar 07 11:52:53 2015 +0000
description:
Avoid kmem_free(NULL) in iwm_read_firmware()
This code path can be hit if the firmware failed to load, for instance
if the file is not present on the filesystem. In this case
firmware_open() fails, and fw->fw_rawdata never gets allocated in the
first place.
diffstat:
sys/dev/pci/if_iwm.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 87777548475d -r 9456347ab1ee sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c Sat Mar 07 09:59:15 2015 +0000
+++ b/sys/dev/pci/if_iwm.c Sat Mar 07 11:52:53 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwm.c,v 1.26 2015/03/04 16:55:11 nonaka Exp $ */
+/* $NetBSD: if_iwm.c,v 1.27 2015/03/07 11:52:53 khorben Exp $ */
/* OpenBSD: if_iwm.c,v 1.35 2015/03/04 15:18:12 jsg Exp */
/*
@@ -105,7 +105,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.26 2015/03/04 16:55:11 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.27 2015/03/07 11:52:53 khorben Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -804,7 +804,7 @@
fw->fw_status = IWM_FW_STATUS_DONE;
wakeup(&sc->sc_fw);
- if (error) {
+ if (error && fw->fw_rawdata != NULL) {
kmem_free(fw->fw_rawdata, fw->fw_rawsize);
fw->fw_rawdata = NULL;
}
Home |
Main Index |
Thread Index |
Old Index