Skip to content

Commit f3584d5

Browse files
Colin Ian Kinggregkh
authored andcommitted
staging/rts5208: fix incorrect shift to extract upper nybble
commit 34ff1bf4920471cff66775dc39537b15c5f0feff upstream. The mask of sns_key_info1 suggests the upper nybble is being extracted however the following shift of 8 bits is too large and always results in 0. Fix this by shifting only by 4 bits to correctly get the upper nybble. Detected by CoverityScan, CID#142891 ("Operands don't affect result") Fixes: fa590c2 ("staging: rts5208: add support for rts5208 and rts5288") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 812e484 commit f3584d5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/staging/rts5208/rtsx_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code,
414414
sense->ascq = ascq;
415415
if (sns_key_info0 != 0) {
416416
sense->sns_key_info[0] = SKSV | sns_key_info0;
417-
sense->sns_key_info[1] = (sns_key_info1 & 0xf0) >> 8;
417+
sense->sns_key_info[1] = (sns_key_info1 & 0xf0) >> 4;
418418
sense->sns_key_info[2] = sns_key_info1 & 0x0f;
419419
}
420420
}

0 commit comments

Comments
 (0)