Fix a couple of Coverity Unintended sign extension sign extension
defects. When shifting an unsigned byte into the upper 8 bits of an int and the resulting value is greater than 0x7FFFFFF, the result will be sign extended when converting to a 64 bit unsigned long. Fix by casting to (uint64_t) before the shift. Reported by: Coverity CID: 1356044, 1356045 Reviewed by: ken
This commit is contained in:
parent
4122004b6c
commit
1b6bea5af7
@ -5188,7 +5188,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error,
|
||||
desc->count_7_0;
|
||||
*lba = ((uint64_t)desc->lba_47_40 << 40) |
|
||||
((uint64_t)desc->lba_39_32 << 32) |
|
||||
(desc->lba_31_24 << 24) |
|
||||
((uint64_t)desc->lba_31_24 << 24) |
|
||||
(desc->lba_23_16 << 16) |
|
||||
(desc->lba_15_8 << 8) |
|
||||
desc->lba_7_0;
|
||||
@ -5249,7 +5249,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error,
|
||||
(res->lba_low);
|
||||
if (res->flags & CAM_ATAIO_48BIT) {
|
||||
*count |= (res->sector_count_exp << 8);
|
||||
*lba |= (res->lba_low_exp << 24) |
|
||||
*lba |= ((uint64_t)res->lba_low_exp << 24) |
|
||||
((uint64_t)res->lba_mid_exp << 32) |
|
||||
((uint64_t)res->lba_high_exp << 40);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user