Commit a55273d7 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging/rts5208: fix incorrect shift to extract upper nybble

commit 34ff1bf4 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: fa590c22 ("staging: rts5208: add support for rts5208 and rts5288")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9bf12567
...@@ -414,7 +414,7 @@ void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code, ...@@ -414,7 +414,7 @@ void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code,
sense->ascq = ascq; sense->ascq = ascq;
if (sns_key_info0 != 0) { if (sns_key_info0 != 0) {
sense->sns_key_info[0] = SKSV | sns_key_info0; sense->sns_key_info[0] = SKSV | sns_key_info0;
sense->sns_key_info[1] = (sns_key_info1 & 0xf0) >> 8; sense->sns_key_info[1] = (sns_key_info1 & 0xf0) >> 4;
sense->sns_key_info[2] = sns_key_info1 & 0x0f; sense->sns_key_info[2] = sns_key_info1 & 0x0f;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment