* [PATCH] drivers/scsi/sr_ioctl.c: check for failed allocation
@ 2005-04-21 14:45 Nate Dailey
0 siblings, 0 replies; only message in thread
From: Nate Dailey @ 2005-04-21 14:45 UTC (permalink / raw)
To: axboe; +Cc: linux-scsi
Hi,
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.
This patch against 2.6.12-rc2 adds a check.
Nate Dailey
Stratus Technologies
Signed-off-by: Nate Dailey <nate.dailey@stratus.com>
--- linux-2.6.12-rc2/drivers/scsi/sr_ioctl.c.orig 2005-04-20 11:31:27.000000000 -0400
+++ linux-2.6.12-rc2/drivers/scsi/sr_ioctl.c 2005-04-20 11:33:58.000000000 -0400
@@ -281,6 +281,9 @@ int sr_get_mcn(struct cdrom_device_info
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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-21 14:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21 14:45 [PATCH] drivers/scsi/sr_ioctl.c: check for failed allocation Nate Dailey
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.