diff options
author | 2015-09-01 07:09:55 +0000 | |
---|---|---|
committer | 2015-09-01 07:09:55 +0000 | |
commit | 11c713bcc29490e269f3f1c3be6d6ad0a3b9035b (patch) | |
tree | 3883c7fb8aa8ef54ecbc6cb01c18cae6aac83e1e /sys/dev/pci/if_ipw.c | |
parent | Only advertise the color depth we actually support. This makes the (diff) | |
download | wireguard-openbsd-11c713bcc29490e269f3f1c3be6d6ad0a3b9035b.tar.xz wireguard-openbsd-11c713bcc29490e269f3f1c3be6d6ad0a3b9035b.zip |
sizes for free(), mostly related to firmwares.
ok dlg
Diffstat (limited to 'sys/dev/pci/if_ipw.c')
-rw-r--r-- | sys/dev/pci/if_ipw.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 496545b731f..0bdf8ce88bf 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.108 2015/05/27 22:10:52 kettenis Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.109 2015/09/01 07:09:55 deraadt Exp $ */ /*- * Copyright (c) 2004-2008 @@ -1632,7 +1632,6 @@ ipw_read_firmware(struct ipw_softc *sc, struct ipw_firmware *fw) { const struct ipw_firmware_hdr *hdr; const char *name; - size_t size; int error; switch (sc->sc_ic.ic_opmode) { @@ -1651,10 +1650,10 @@ ipw_read_firmware(struct ipw_softc *sc, struct ipw_firmware *fw) /* should not get there */ return ENODEV; } - if ((error = loadfirmware(name, &fw->data, &size)) != 0) + if ((error = loadfirmware(name, &fw->data, &fw->size)) != 0) return error; - if (size < sizeof (*hdr)) { + if (fw->size < sizeof (*hdr)) { error = EINVAL; goto fail; } @@ -1662,7 +1661,7 @@ ipw_read_firmware(struct ipw_softc *sc, struct ipw_firmware *fw) fw->main_size = letoh32(hdr->main_size); fw->ucode_size = letoh32(hdr->ucode_size); - if (size < sizeof (*hdr) + fw->main_size + fw->ucode_size) { + if (fw->size < sizeof (*hdr) + fw->main_size + fw->ucode_size) { error = EINVAL; goto fail; } @@ -1671,7 +1670,7 @@ ipw_read_firmware(struct ipw_softc *sc, struct ipw_firmware *fw) return 0; -fail: free(fw->data, M_DEVBUF, 0); +fail: free(fw->data, M_DEVBUF, fw->size); return error; } @@ -2012,7 +2011,7 @@ ipw_init(struct ifnet *ifp) goto fail2; } sc->sc_flags |= IPW_FLAG_FW_INITED; - free(fw.data, M_DEVBUF, 0); + free(fw.data, M_DEVBUF, fw.size); fw.data = NULL; /* retrieve information tables base addresses */ @@ -2037,7 +2036,7 @@ ipw_init(struct ifnet *ifp) return 0; -fail2: free(fw.data, M_DEVBUF, 0); +fail2: free(fw.data, M_DEVBUF, fw.size); fw.data = NULL; fail1: ipw_stop(ifp, 0); return error; |