Re: [PATCH v2 4/5] scsi/st: Use get_unaligned_be24() and sign_extend32()

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

 



On Thu, Mar 12, 2020 at 07:37:17PM -0700, Bart Van Assche wrote:
> @@ -2680,8 +2681,7 @@ static void deb_space_print(struct scsi_tape *STp, int direction, char *units, u
>  	if (!debugging)
>  		return;
>  
> -	sc = cmd[2] & 0x80 ? 0xff000000 : 0;
> -	sc |= (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
> +	sc = sign_extend32(get_unaligned_be24(&cmd[2]), 23);

Btw, didn't the old code here have undefined behavior if cmd[] is
a u8 and we shift by a larger amount?



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux