Commit 3a73e8c7 authored by Nate Dailey's avatar Nate Dailey Committed by James Bottomley

[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: default avatarNate Dailey <nate.dailey@stratus.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 0bdcd78e
...@@ -281,6 +281,9 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) ...@@ -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)); char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
int result; int result;
if (!buffer)
return -ENOMEM;
memset(&cgc, 0, sizeof(struct packet_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
cgc.cmd[2] = 0x40; /* I do want the subchannel info */ cgc.cmd[2] = 0x40; /* I do want the subchannel info */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment