[PATCH] pktcdvd: Correctly set rq->cmd_len in pkt_generic_packet()
authorPeter Osterlund <petero2@telia.com>
Tue, 21 Feb 2006 02:28:01 +0000 (18:28 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 21 Feb 2006 04:00:10 +0000 (20:00 -0800)
It looks like the code in pkt_generic_packet() worked by luck in the past, but
after commit 186d330e682210100c671355580a8592e4a21692 leaving rq->cmd_len
uninitialized doesn't work any more.

Signed-off-by: Peter Osterlund <petero2@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/pktcdvd.c

index 93e44d0292ab7aa56c04c4552ef2607bb6add19b..f40310a42ba182117fd71d1fb51166d1af1bb996 100644 (file)
@@ -58,6 +58,7 @@
 #include <linux/suspend.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_ioctl.h>
+#include <scsi/scsi.h>
 
 #include <asm/uaccess.h>
 
@@ -380,6 +381,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
        memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE);
        if (sizeof(rq->cmd) > CDROM_PACKET_SIZE)
                memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE);
+       rq->cmd_len = COMMAND_SIZE(rq->cmd[0]);
 
        rq->ref_count++;
        rq->flags |= REQ_NOMERGE;