public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] check kmalloc return in ide-cd.c (244-ac16)
@ 2001-05-25 19:34 Rasmus Andersen
  2001-05-25 21:02 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Andersen @ 2001-05-25 19:34 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel

Hi.

This patch adds a check for the return value from kmalloc in
ide_cdrom_open. Applies against ac16.


--- linux-244-ac16-clean/drivers/ide/ide-cd.c	Fri May 25 21:11:08 2001
+++ linux-244-ac16/drivers/ide/ide-cd.c	Fri May 25 21:30:20 2001
@@ -2869,12 +2869,12 @@
 int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
 {
 	struct cdrom_info *info = drive->driver_data;
-	int rc;
+	int rc = -ENOMEM;
 
 	MOD_INC_USE_COUNT;
 	if (info->buffer == NULL)
 		info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
-	if ((rc = cdrom_fops.open(ip, fp))) {
+        if ((info->buffer == NULL) || (rc = cdrom_fops.open(ip, fp))) {
 		drive->usage--;
 		MOD_DEC_USE_COUNT;
 	}
-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

The police are not here to create disorder.  They're here to preserve
disorder." -Former Chicago mayor Daley during the infamous 1968 Democratic
Party convention

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] check kmalloc return in ide-cd.c (244-ac16)
  2001-05-25 19:34 [PATCH] check kmalloc return in ide-cd.c (244-ac16) Rasmus Andersen
@ 2001-05-25 21:02 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2001-05-25 21:02 UTC (permalink / raw)
  To: Rasmus Andersen; +Cc: linux-kernel

On Fri, May 25 2001, Rasmus Andersen wrote:
> Hi.
> 
> This patch adds a check for the return value from kmalloc in
> ide_cdrom_open. Applies against ac16.

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-25 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-25 19:34 [PATCH] check kmalloc return in ide-cd.c (244-ac16) Rasmus Andersen
2001-05-25 21:02 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox