Re: [PATCH] scsi: fix unintended sign extension on left shifts

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

 



On 10/14/19 5:16 AM, Colin King wrote:
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 0f17e7dac1b0..1d3a5a2dc229 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -38,7 +38,7 @@ scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len)
  	const char *ret = trace_seq_buffer_ptr(p);
  	sector_t lba = 0, txlen = 0;
- lba |= (cdb[2] << 24);
+	lba |= ((u64)cdb[2] << 24);
  	lba |= (cdb[3] << 16);
  	lba |= (cdb[4] << 8);
  	lba |=  cdb[5];

Have you considered to use get/put_unaligned_be*() instead of making the above change?

Thanks,

Bart.



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux