From: bluhm Date: Mon, 1 Jan 2018 16:16:23 +0000 (+0000) Subject: The missing NULL check for the return value of malloc(9) with X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=71db4ff6bbee6140c600730e6451b94e3e9f7d7b;p=openbsd The missing NULL check for the return value of malloc(9) with M_NOWAIT is wrong. Use M_WAITOK in ipmi_match() during attach. OK kettenis@ --- diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 788838a1d60..4e3be12e6e2 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.99 2017/09/08 05:36:52 deraadt Exp $ */ +/* $OpenBSD: ipmi.c,v 1.100 2018/01/01 16:16:23 bluhm Exp $ */ /* * Copyright (c) 2015 Masao Uebayashi @@ -1652,7 +1652,7 @@ ipmi_match(struct device *parent, void *match, void *aux) return (0); /* XXX local softc is wrong wrong wrong */ - sc = malloc(sizeof(*sc), M_TEMP, M_NOWAIT | M_ZERO); + sc = malloc(sizeof(*sc), M_TEMP, M_WAITOK | M_ZERO); mtx_init(&sc->sc_cmd_mtx, IPL_NONE); strlcpy(sc->sc_dev.dv_xname, "ipmi0", sizeof(sc->sc_dev.dv_xname));