All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nate Dailey <nhdailey@verizon.net>
To: axboe@suse.de
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] drivers/scsi/sr_ioctl.c: check for failed allocation
Date: Thu, 21 Apr 2005 09:45:22 -0500 (CDT)	[thread overview]
Message-ID: <5385768.1114094722652.JavaMail.root@vms064.mailsrvcs.net> (raw)

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 */



                 reply	other threads:[~2005-04-21 14:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5385768.1114094722652.JavaMail.root@vms064.mailsrvcs.net \
    --to=nhdailey@verizon.net \
    --cc=axboe@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.