From f5866522ce809195f3ca3e0408150dde40695533 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 25 Jul 2013 09:12:46 +0000 Subject: [PATCH] Add missing NULL check after malloc(M_NOWAIT). Submitted by: Dmitry Luhtionov --- sys/dev/ata/chipsets/ata-promise.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/ata/chipsets/ata-promise.c b/sys/dev/ata/chipsets/ata-promise.c index 40a7f72bbda9..62f25bd28052 100644 --- a/sys/dev/ata/chipsets/ata-promise.c +++ b/sys/dev/ata/chipsets/ata-promise.c @@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev) /* setup host packet controls */ hpkt = malloc(sizeof(struct ata_promise_sx4), M_ATAPCI, M_NOWAIT | M_ZERO); + if (hpkt == NULL) { + device_printf(dev, "Cannot allocate HPKT\n"); + goto failnfree; + } mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); TAILQ_INIT(&hpkt->queue); hpkt->busy = 0;