check kmalloc return in ide-cd.c (244-ac16)
PATCH 1/1 check kmalloc return in ide-cd.c (244-ac16)
Hi.
This patch adds a check for the return value from kmalloc in ide_cdrom_open. Applies against ac16.
drivers/ide/ide-cd.c +2 -2
@@ -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 ; }
Signature · 6 lines
Regards,
Rasmus([email protected])
The police are not here to create disorder. They're here to preserve
disorder." -Former Chicago mayor Daley during the infamous 1968 Democratic
Party conventionJens Axboe
AppliedQuoted 4 lines · Rasmus Andersen
Hi.
This patch adds a check for the return value from kmalloc in
ide_cdrom_open. Applies against ac16.
Thanks, applied.
Signature · 1 line
Jens Axboe