diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2018-10-12 19:08:42 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-10-25 11:17:40 -0600 |
commit | 5f832a395859de7191e638e3777ae57f37d46d08 (patch) | |
tree | 54acd5b024436bdffffeee21e11e0783d254d624 /block/blk-zoned.c | |
parent | d2e428e49eec9b7ff175d7d5941d50e5a7d15324 (diff) |
scsi: sd_zbc: Fix sd_zbc_check_zones() error checks
The unsigned 32 bits overflow check for the zone size value is already
done within sd_zbc_check_zones() with the test:
} else if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) {
so there is no need to check again for an out of range value in
sd_zbc_read_zones(). Simplify the code and fix sd_zbc_check_zones()
error return to -EFBIG instead of -ENODEV if the zone size is too large.
Change the return type of sd_zbc_check_zones() to an int for the error
code and return the zone size (zone_blocks) through a u32 pointer to
avoid overflowing the signed 32 return value.
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-zoned.c')
0 files changed, 0 insertions, 0 deletions