diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-04-13 12:02:17 +0800 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-04-13 12:02:17 +0800 |
| commit | ad592b70ae97800d4f5bf535d45a680649e2789e (patch) | |
| tree | 340a684df3e8dc3d893297f43c025c82e94cbb6a /drivers/scsi/scsi_common.c | |
| parent | f96884662e5ca42a3a39854454f5efd04342b48b (diff) | |
| parent | b40108b826ed9e1c558f73b9dbabb8d80ded268b (diff) | |
Merge tag 'v4.4.7' into linux-linaro-lsk-v4.4
This is the 4.4.7 stable release
Diffstat (limited to 'drivers/scsi/scsi_common.c')
| -rw-r--r-- | drivers/scsi/scsi_common.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c index c126966130ab..ce79de822e46 100644 --- a/drivers/scsi/scsi_common.c +++ b/drivers/scsi/scsi_common.c @@ -278,8 +278,16 @@ int scsi_set_sense_information(u8 *buf, int buf_len, u64 info) ucp[3] = 0; put_unaligned_be64(info, &ucp[4]); } else if ((buf[0] & 0x7f) == 0x70) { - buf[0] |= 0x80; - put_unaligned_be64(info, &buf[3]); + /* + * Only set the 'VALID' bit if we can represent the value + * correctly; otherwise just fill out the lower bytes and + * clear the 'VALID' flag. + */ + if (info <= 0xffffffffUL) + buf[0] |= 0x80; + else + buf[0] &= 0x7f; + put_unaligned_be32((u32)info, &buf[3]); } return 0; |
