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?