Re: [PATCH v4 1/2] block: fix signed int overflow in Amiga partition support

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

 



Thanks Andreas,

it appears I already made the same error in v2 of this series. My bad.

I'll wait for a few more comments before respinning.

Cheers,

	Michael


Am 30.09.2018 um 19:16 schrieb Andreas Schwab:
On Sep 30 2018, Michael Schmitz <schmitzmic@xxxxxxxxx> wrote:

@@ -100,17 +101,17 @@ int amiga_partition(struct parsed_partitions *state)

 		/* Tell Kernel about it */

-		nr_sects = (be32_to_cpu(pb->pb_Environment[10]) + 1 -
-			    be32_to_cpu(pb->pb_Environment[9])) *
+		nr_sects = (sector_t) ((be32_to_cpu(pb->pb_Environment[10])
+			   + 1 - be32_to_cpu(pb->pb_Environment[9])) *
 			   be32_to_cpu(pb->pb_Environment[3]) *
 			   be32_to_cpu(pb->pb_Environment[5]) *
-			   blksize;
+			   blksize);

That doesn't fix any signed int overflow.  If you want to do calculation
in sector_t you need to cast at least one operand to sector_t.  In this
form the cast is useless.

Andreas.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux