From: Linus Torvalds Date: Tue, 7 Mar 2006 01:41:44 +0000 (-0800) Subject: Allocate 96 bytes for SCSI sense data reply X-Git-Tag: firefly_0821_release~37782 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f716d8303345698728d9f8ce76a82a795a5be275;p=firefly-linux-kernel-4.4.55.git Allocate 96 bytes for SCSI sense data reply The SCSI layer uses SCSI_SENSE_BUFFERSIZE (96) for the sense buffer size, even though some other code uses "sizeof(struct request_sense)" (which is 64 bytes). Allocate the buffer using the bigger of the two for safety. Signed-off-by: Linus Torvalds --- diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 5d02ff4db6cc..b65462f76484 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -192,7 +192,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) SDev = cd->device; if (!sense) { - sense = kmalloc(sizeof(*sense), GFP_KERNEL); + sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); if (!sense) { err = -ENOMEM; goto out;