Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jul 2013 09:12:46 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253644 - head/sys/dev/ata/chipsets
Message-ID:  <201307250912.r6P9CkVE054015@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Jul 25 09:12:46 2013
New Revision: 253644
URL: http://svnweb.freebsd.org/changeset/base/253644

Log:
  Add missing NULL check after malloc(M_NOWAIT).
  
  Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>

Modified:
  head/sys/dev/ata/chipsets/ata-promise.c

Modified: head/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-promise.c	Thu Jul 25 08:41:22 2013	(r253643)
+++ head/sys/dev/ata/chipsets/ata-promise.c	Thu Jul 25 09:12:46 2013	(r253644)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307250912.r6P9CkVE054015>