kern/130735: [patch] pass M_NOWAIT to the malloc() call inside cdreaddvdstructure()

Jaakko Heinonen jh at saunalahti.fi
Mon Jan 19 07:10:04 PST 2009


The following reply was made to PR kern/130735; it has been noted by GNATS.

From: Jaakko Heinonen <jh at saunalahti.fi>
To: Eygene Ryabinkin <rea-fbsd at codelabs.ru>
Cc: bug-followup at FreeBSD.org
Subject: Re: kern/130735: [patch] pass M_NOWAIT to the malloc() call inside
	cdreaddvdstructure()
Date: Mon, 19 Jan 2009 17:06:47 +0200

 Hi,
 
 On 2009-01-19, Eygene Ryabinkin wrote:
 > --- a/sys/cam/scsi/scsi_cd.c
 > +++ b/sys/cam/scsi/scsi_cd.c
 > @@ -4063,7 +4063,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct dvd_struct *dvdstruct)
 >  	}
 >  
 >  	if (length != 0) {
 > -		databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO);
 > +		databuf = malloc(length, M_DEVBUF, M_NOWAIT | M_ZERO);
 >  	} else
 >  		databuf = NULL;
 
 This change doesn't look correct. If you use M_NOWAIT malloc(9) can fail
 and return NULL. You should check the return value.
 
 -- 
 Jaakko


More information about the freebsd-bugs mailing list