Re: [PATCH v4 6/6] block: use chunk_sectors when evaluating stacked atomic write limits

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

 



On 08/07/2025 17:59, Mikulas Patocka wrote:
+
+	/*
+	 * If chunk sectors is so large that its value in bytes overflows
+	 * UINT_MAX, then just shift it down so it definitely will fit.
+	 * We don't support atomic writes of such a large size anyway.
+	 */
+	if ((unsigned long)chunk_sectors << SECTOR_SHIFT > UINT_MAX)
+		chunk_bytes = chunk_sectors;
+	else
+		chunk_bytes = chunk_sectors << SECTOR_SHIFT;
Why do we cast it to unsigned long? unsigned long is 32-bit on 32-bit
machines, so the code will not detect the overflow in that case. We should
cast it to unsigned long long (or uint64_t).

Right, I said earlier that I would use an unsigned long long, but didn't do it that way, which was unintentional.

Anyway, I will change this code as suggested by Nilay.

Thanks,
John





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux