Don't allocate memory and return EFTYPE if sc->sc_blobsize==0 to prevent
panic in firmware_malloc().
This commit is contained in:
parent
1879ee6236
commit
bf88e6fa0d
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $ */
|
||||
/* $NetBSD: kern_cpu.c,v 1.74 2018/07/04 07:25:47 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
|
||||
@ -56,7 +56,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.74 2018/07/04 07:25:47 msaitoh Exp $");
|
||||
|
||||
#include "opt_cpu_ucode.h"
|
||||
|
||||
@ -602,6 +602,11 @@ cpu_ucode_load(struct cpu_ucode_softc *sc, const char *fwname)
|
||||
}
|
||||
|
||||
sc->sc_blobsize = firmware_get_size(fwh);
|
||||
if (sc->sc_blobsize == 0) {
|
||||
error = EFTYPE;
|
||||
firmware_close(fwh);
|
||||
goto err0;
|
||||
}
|
||||
sc->sc_blob = firmware_malloc(sc->sc_blobsize);
|
||||
if (sc->sc_blob == NULL) {
|
||||
error = ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user