Re: [PATCH 4/4] cdrom: revert commit 22a9189 (cdrom: use kmalloced buffers instead of buffers on stack)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> wrote:
> The commit 22a9189fd073db3d03a4cf8b8c098aa207602de1 (cdrom: use
> kmalloced buffers instead of buffers on stack) is introduced to use
> kmalloced buffers for packet commands to avoid stack corruption on non
> coherent platforms.
>
> SCSI cdrom uses blk_rq_map_kern (the commit
> 68154e90c9d1492d570671ae181d9a8f8530da55) post 2.6.25. So sr_packet
> uses allocated pages when necessary. IDE cdrom has a mechnism to
> handle alignment and padding. So we don't need this extra complexitiy
> in cdrom.c.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
[...]
> @@ -837,14 +796,10 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
>  static int mo_open_write(struct cdrom_device_info *cdi)
>  {
>  	struct packet_command cgc;
> -	char *buffer;
> +	char buffer[255];
>  	int ret;
>  
> -	buffer = kmalloc(255, GFP_KERNEL);
> -	if (!buffer)
> -		return -ENOMEM;
> -
> -	init_cdrom_command(&cgc, buffer, 4, CGC_DATA_READ);
> +	init_cdrom_command(&cgc, &buffer, 4, CGC_DATA_READ);
				 ^
Careful here.

Regards,

Elias
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux