]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
staging/rts5208: fix incorrect shift to extract upper nybble
authorColin Ian King <colin.king@canonical.com>
Fri, 18 Aug 2017 13:34:16 +0000 (14:34 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Sun, 10 Sep 2017 23:08:41 +0000 (18:08 -0500)
BugLink: http://bugs.launchpad.net/bugs/1716284
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: fa590c222fba ("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>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/staging/rts5208/rtsx_scsi.c

index 36b5a11f21d2af4323f7e9484869e43f9980ac9b..a401b13f5f5e4923a6b2580eee50fff25b1d2b9d 100644 (file)
@@ -414,7 +414,7 @@ void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code,
        sense->ascq = ascq;
        if (sns_key_info0 != 0) {
                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;
        }
 }