Re: [PATCH v7 2/2] block: add overflow checks for Amiga partition support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Jun 2023, Michael Schmitz wrote:

My last version (v9) still applies, but that one still threw a sparse 
warning for patch 2:

Link:https://lore.kernel.org/all/202208231319.Ng5RTzzg-lkp@xxxxxxxxx

Not sure how to treat that one - rdb_CylBlocks is not declared as big 
endian so the warning is correct, but as far as I can see, for all 
practical purposes rdb_CylBlocks would be expected to be in big endian 
order (partition usually prepared on a big endian system)?

I can drop the be32_to_cpu conversion (and would expect to see a warning 
printed on little endian systems), or force the cast to __be32. Or 
rather drop that consistency check outright...


The new warning comes from this new code:

		if (cylblk > be32_to_cpu((__be32)rdb->rdb_CylBlocks)) {
			pr_warn("Dev %s: cylblk %u > rdb_CylBlocks %u!\n",
				state->disk->disk_name, cylblk,
				be32_to_cpu(rdb->rdb_CylBlocks));
		}

The __be32 cast appears in the first line but not the fourth, which is an 
inconsistency you might want to tidy up. However, both lines produce the 
same sparse warning here.

The inconsistent use of big-endian and native-endian members in struct 
RigidDiskBlock looks like the root cause to me but I know nothing about 
Amiga partition maps so I'm not going to guess.



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux