diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2016-10-21 15:15:09 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2016-10-21 15:15:09 +0000 |
commit | 5d10c1611f5039784b413b6a1e37e8414c8bf086 (patch) | |
tree | ae95f89f5b3570c3b0635c4a6406ef798633115b /sys | |
parent | 239e45213756ba78bd9601005f9ba60c3f644e34 (diff) |
Check if memory allocation failed.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/octeon/dev/cn30xxgmx.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/octeon/dev/cn30xxgmx.c b/sys/arch/octeon/dev/cn30xxgmx.c index c859c52e5ed..9f95a26f6e8 100644 --- a/sys/arch/octeon/dev/cn30xxgmx.c +++ b/sys/arch/octeon/dev/cn30xxgmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxgmx.c,v 1.27 2016/10/21 15:06:14 visa Exp $ */ +/* $OpenBSD: cn30xxgmx.c,v 1.28 2016/10/21 15:15:08 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -227,6 +227,10 @@ cn30xxgmx_attach(struct device *parent, struct device *self, void *aux) sc->sc_ports = mallocarray(sc->sc_nports, sizeof(*sc->sc_ports), M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->sc_ports == NULL) { + printf("%s: out of memory\n", sc->sc_dev.dv_xname); + return; + } for (i = 0; i < sc->sc_nports; i++) { port_sc = &sc->sc_ports[i]; |