diff options
author | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-01-11 01:31:22 +0000 |
---|---|---|
committer | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-01-11 01:31:22 +0000 |
commit | 9f1463a8c6c1b28e4c9707469ac02a119f30e7d6 (patch) | |
tree | b490775c6ff2c2cdc16c838a4b8d549d5a9df526 /sys/dev/pci/if_sk.c | |
parent | d668db69c49261c2e533abf4df3ce0735530a1f8 (diff) |
Check result from malloc(9) when using M_NOWAIT. fgsch@ ok
Diffstat (limited to 'sys/dev/pci/if_sk.c')
-rw-r--r-- | sys/dev/pci/if_sk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 554d817c649..85e2a052341 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.19 2001/11/06 19:53:19 miod Exp $ */ +/* $OpenBSD: if_sk.c,v 1.20 2002/01/11 01:31:21 nordin Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -304,6 +304,8 @@ void sk_vpd_read(sc) pos += sizeof(res); sc->sk_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_NOWAIT); + if (sc->sk_vpd_prodname == NULL) + panic("sk_vpd_read"); for (i = 0; i < res.vr_len; i++) sc->sk_vpd_prodname[i] = sk_vpd_readbyte(sc, i + pos); sc->sk_vpd_prodname[i] = '\0'; @@ -319,6 +321,8 @@ void sk_vpd_read(sc) pos += sizeof(res); sc->sk_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_NOWAIT); + if (sc->sk_vpd_readonly == NULL) + panic("sk_vpd_read"); for (i = 0; i < res.vr_len + 1; i++) sc->sk_vpd_readonly[i] = sk_vpd_readbyte(sc, i + pos); |