Skip to content

Commit 7eb1e47

Browse files
Michael Schmitzaxboe
authored andcommitted
block/partition: fix signedness issue for Amiga partitions
Making 'blk' sector_t (i.e. 64 bit if LBD support is active) fails the 'blk>0' test in the partition block loop if a value of (signed int) -1 is used to mark the end of the partition block list. Explicitly cast 'blk' to signed int to allow use of -1 to terminate the partition block linked list. Fixes: b6f3f28 ("block: add overflow checks for Amiga partition support") Reported-by: Christian Zigotzky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael Schmitz <[email protected]> Reviewed-by: Martin Steigerwald <[email protected]> Tested-by: Christian Zigotzky <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 6cd06ab commit 7eb1e47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/partitions/amiga.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int amiga_partition(struct parsed_partitions *state)
9090
}
9191
blk = be32_to_cpu(rdb->rdb_PartitionList);
9292
put_dev_sector(sect);
93-
for (part = 1; blk>0 && part<=16; part++, put_dev_sector(sect)) {
93+
for (part = 1; (s32) blk>0 && part<=16; part++, put_dev_sector(sect)) {
9494
/* Read in terms partition table understands */
9595
if (check_mul_overflow(blk, (sector_t) blksize, &blk)) {
9696
pr_err("Dev %s: overflow calculating partition block %llu! Skipping partitions %u and beyond\n",

0 commit comments

Comments
 (0)