Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jul 2013 12:14:28 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Alexander Motin <mav@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r253644 - head/sys/dev/ata/chipsets
Message-ID:  <201307251214.29191.jhb@freebsd.org>
In-Reply-To: <201307250912.r6P9CkVE054015@svn.freebsd.org>
References:  <201307250912.r6P9CkVE054015@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, July 25, 2013 5:12:46 am Alexander Motin wrote:
> 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;

Why not use M_WAITOK here?

-- 
John Baldwin



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