Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Pass a correct firmware size (instead of 0) to firmware_...
details: https://anonhg.NetBSD.org/src/rev/245ce8047dee
branches: trunk
changeset: 335455:245ce8047dee
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Jan 07 07:05:48 2015 +0000
description:
Pass a correct firmware size (instead of 0) to firmware_free
firmware_free now uses kmem_free(9) instead of free(9),
so we need to pass a correct size to it.
diffstat:
sys/arch/x86/x86/cpu_ucode.c | 8 ++++----
sys/arch/xen/xen/xen_ucode.c | 8 ++++----
sys/dev/i2c/xc3028.c | 6 +++---
sys/dev/i2c/xc5k.c | 6 +++---
sys/dev/ic/bwi.c | 8 ++++----
sys/dev/ic/rt2661.c | 10 +++++-----
sys/dev/pci/if_ipw.c | 12 ++++++------
sys/dev/pci/if_iwi.c | 9 +++++----
sys/dev/pci/if_iwivar.h | 3 ++-
sys/dev/usb/if_athn_usb.c | 10 +++++-----
sys/dev/usb/if_rum.c | 10 +++++-----
sys/dev/usb/if_urtwn.c | 8 ++++----
sys/dev/usb/if_zyd.c | 10 +++++-----
sys/kern/kern_cpu.c | 8 ++++----
14 files changed, 59 insertions(+), 57 deletions(-)
diffs (truncated from 505 to 300 lines):
diff -r 2f862c285fcd -r 245ce8047dee sys/arch/x86/x86/cpu_ucode.c
--- a/sys/arch/x86/x86/cpu_ucode.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/arch/x86/x86/cpu_ucode.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.4 2013/07/06 12:03:11 gdt Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.4 2013/07/06 12:03:11 gdt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
#include "opt_cpu_ucode.h"
#include "opt_compat_netbsd.h"
@@ -116,7 +116,7 @@
}
if (sc->sc_blob != NULL)
- firmware_free(sc->sc_blob, 0);
+ firmware_free(sc->sc_blob, sc->sc_blobsize);
sc->sc_blob = NULL;
sc->sc_blobsize = 0;
return error;
@@ -140,7 +140,7 @@
error = cpu_ucode_amd_apply(sc, CPU_UCODE_ALL_CPUS);
if (sc->sc_blob != NULL)
- firmware_free(sc->sc_blob, 0);
+ firmware_free(sc->sc_blob, sc->sc_blobsize);
sc->sc_blob = NULL;
sc->sc_blobsize = 0;
return error;
diff -r 2f862c285fcd -r 245ce8047dee sys/arch/xen/xen/xen_ucode.c
--- a/sys/arch/xen/xen/xen_ucode.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/arch/xen/xen/xen_ucode.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ucode.c,v 1.4 2013/07/06 12:06:24 gdt Exp $ */
+/* $NetBSD: xen_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
/*
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.4 2013/07/06 12:06:24 gdt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
#include "opt_cpu_ucode.h"
#include "opt_compat_netbsd.h"
@@ -115,7 +115,7 @@
error = -HYPERVISOR_platform_op(&op);
if (sc->sc_blob)
- firmware_free(sc->sc_blob, 0);
+ firmware_free(sc->sc_blob, sc->sc_blobsize);
sc->sc_blob = NULL;
sc->sc_blobsize = 0;
return error;
@@ -141,7 +141,7 @@
error = -HYPERVISOR_platform_op(&op);
if (sc->sc_blob != NULL)
- firmware_free(sc->sc_blob, 0);
+ firmware_free(sc->sc_blob, sc->sc_blobsize);
sc->sc_blob = NULL;
sc->sc_blobsize = 0;
return error;
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/i2c/xc3028.c
--- a/sys/dev/i2c/xc3028.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/i2c/xc3028.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xc3028.c,v 1.5 2011/10/02 19:03:56 jmcneill Exp $ */
+/* $NetBSD: xc3028.c,v 1.6 2015/01/07 07:05:48 ozaki-r Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.5 2011/10/02 19:03:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.6 2015/01/07 07:05:48 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -219,7 +219,7 @@
done:
if (fw)
- firmware_free(fw, 0);
+ firmware_free(fw, fwlen);
mutex_exit(&xc3028_firmware_lock);
if (error)
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/i2c/xc5k.c
--- a/sys/dev/i2c/xc5k.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/i2c/xc5k.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xc5k.c,v 1.4 2011/10/02 19:03:56 jmcneill Exp $ */
+/* $NetBSD: xc5k.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
/*-
* Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xc5k.c,v 1.4 2011/10/02 19:03:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xc5k.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -174,7 +174,7 @@
done:
if (fw)
- firmware_free(fw, 0);
+ firmware_free(fw, fwlen);
mutex_exit(&xc5k_firmware_lock);
if (error)
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/ic/bwi.c
--- a/sys/dev/ic/bwi.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/ic/bwi.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwi.c,v 1.24 2014/02/25 18:30:09 pooka Exp $ */
+/* $NetBSD: bwi.c,v 1.25 2015/01/07 07:05:48 ozaki-r Exp $ */
/* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */
/*
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.24 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.25 2015/01/07 07:05:48 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -1939,7 +1939,7 @@
error = EINVAL;
free_and_fail:
- firmware_free(fwi->fwi_data, 0);
+ firmware_free(fwi->fwi_data, fwi->fwi_size);
fwi->fwi_data = NULL;
fwi->fwi_size = 0;
@@ -1953,7 +1953,7 @@
if (fwi->fwi_data != NULL) {
DPRINTF(mac->mac_sc, BWI_DBG_FIRMWARE, "freeing firmware %s\n",
fwi->fwi_name);
- firmware_free(fwi->fwi_data, 0);
+ firmware_free(fwi->fwi_data, fwi->fwi_size);
fwi->fwi_data = NULL;
fwi->fwi_size = 0;
}
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/ic/rt2661.c
--- a/sys/dev/ic/rt2661.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/ic/rt2661.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2661.c,v 1.29 2012/02/18 13:38:36 drochner Exp $ */
+/* $NetBSD: rt2661.c,v 1.30 2015/01/07 07:05:48 ozaki-r Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.29 2012/02/18 13:38:36 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.30 2015/01/07 07:05:48 ozaki-r Exp $");
#include <sys/param.h>
@@ -2572,7 +2572,7 @@
if (firmware_read(fh, 0, ucode, size) != 0) {
aprint_error_dev(sc->sc_dev, "could not read microcode %s\n", name);
- firmware_free(ucode, 0);
+ firmware_free(ucode, size);
firmware_close(fh);
rt2661_stop(ifp, 1);
return EIO;
@@ -2580,13 +2580,13 @@
if (rt2661_load_microcode(sc, ucode, size) != 0) {
aprint_error_dev(sc->sc_dev, "could not load 8051 microcode\n");
- firmware_free(ucode, 0);
+ firmware_free(ucode, size);
firmware_close(fh);
rt2661_stop(ifp, 1);
return EIO;
}
- firmware_free(ucode, 0);
+ firmware_free(ucode, size);
firmware_close(fh);
sc->sc_flags |= RT2661_FWLOADED;
}
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/pci/if_ipw.c
--- a/sys/dev/pci/if_ipw.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/pci/if_ipw.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ipw.c,v 1.57 2014/03/29 19:28:24 christos Exp $ */
+/* $NetBSD: if_ipw.c,v 1.58 2015/01/07 07:05:48 ozaki-r Exp $ */
/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
/*-
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.57 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.58 2015/01/07 07:05:48 ozaki-r Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1907,8 +1907,8 @@
return 0;
-fail3: firmware_free(fw->ucode, 0);
-fail2: firmware_free(fw->main, 0);
+fail3: firmware_free(fw->ucode, fw->ucode_size);
+fail2: firmware_free(fw->main, fw->main_size);
fail1: firmware_close(fwh);
fail0:
return error;
@@ -1920,8 +1920,8 @@
if (!(sc->flags & IPW_FLAG_FW_CACHED))
return;
- firmware_free(sc->fw.main, 0);
- firmware_free(sc->fw.ucode, 0);
+ firmware_free(sc->fw.main, sc->fw.main_size);
+ firmware_free(sc->fw.ucode, sc->fw.ucode_size);
sc->flags &= ~IPW_FLAG_FW_CACHED;
}
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/pci/if_iwi.c
--- a/sys/dev/pci/if_iwi.c Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/pci/if_iwi.c Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwi.c,v 1.97 2014/03/29 19:28:24 christos Exp $ */
+/* $NetBSD: if_iwi.c,v 1.98 2015/01/07 07:05:48 ozaki-r Exp $ */
/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
/*-
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.97 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.98 2015/01/07 07:05:48 ozaki-r Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -2187,6 +2187,7 @@
error = EIO;
goto fail1;
}
+ sc->sc_blobsize = size;
sc->sc_blob = firmware_malloc(size);
if (sc->sc_blob == NULL) {
@@ -2246,7 +2247,7 @@
return 0;
-fail2: firmware_free(sc->sc_blob, 0);
+fail2: firmware_free(sc->sc_blob, sc->sc_blobsize);
fail1:
return error;
}
@@ -2258,7 +2259,7 @@
if (!(sc->flags & IWI_FLAG_FW_CACHED))
return;
- firmware_free(sc->sc_blob, 0);
+ firmware_free(sc->sc_blob, sc->sc_blobsize);
sc->flags &= ~IWI_FLAG_FW_CACHED;
}
diff -r 2f862c285fcd -r 245ce8047dee sys/dev/pci/if_iwivar.h
--- a/sys/dev/pci/if_iwivar.h Wed Jan 07 04:05:26 2015 +0000
+++ b/sys/dev/pci/if_iwivar.h Wed Jan 07 07:05:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwivar.h,v 1.16 2010/01/19 22:07:00 pooka Exp $ */
+/* $NetBSD: if_iwivar.h,v 1.17 2015/01/07 07:05:48 ozaki-r Exp $ */
/*-
* Copyright (c) 2004, 2005
@@ -123,6 +123,7 @@
struct iwi_firmware fw;
Home |
Main Index |
Thread Index |
Old Index