From: Nate Dailey Date: Thu, 21 Apr 2005 20:14:05 +0000 (-0400) Subject: [SCSI] drivers/scsi/sr_ioctl.c: check for failed allocation X-Git-Tag: upstream/snapshot3+hdmi~47967^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a73e8c7715cdf53c24b602bfca15ec54d7c989b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [SCSI] drivers/scsi/sr_ioctl.c: check for failed allocation I noticed a case in sr_ioctl.c's sr_get_mcn where a buffer is allocated, but the pointer isn't checked for null. Signed-off-by: Nate Dailey Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 3471be0..82d68fd 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -281,6 +281,9 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); int result; + if (!buffer) + return -ENOMEM; + memset(&cgc, 0, sizeof(struct packet_command)); cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; cgc.cmd[2] = 0x40; /* I do want the subchannel info */