Date: Mon, 19 Jan 2009 15:10:03 GMT From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/130735: [patch] pass M_NOWAIT to the malloc() call inside cdreaddvdstructure() Message-ID: <200901191510.n0JFA3TY045546@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/130735; it has been noted by GNATS.
From: Jaakko Heinonen <jh@saunalahti.fi>
To: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Cc: bug-followup@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901191510.n0JFA3TY045546>
