lkml.org 
[lkml]   [2019]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] scsi: fix unintended sign extension on left shifts
On Mon, Oct 14, 2019 at 08:58:03AM -0700, Bart Van Assche wrote:
> On 10/14/19 5:16 AM, Colin King wrote:
> > 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?

Agreed, that is the only sensible thing to do here.

\
 
 \ /
  Last update: 2019-10-15 09:45    [W:0.045 / U:1.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site