[PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]

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

 



include/pt-sgi.h:103:7: runtime error: unsigned integer overflow: 0 -
1186450447 cannot be represented in type 'unsigned int'

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 include/pt-sgi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/pt-sgi.h b/include/pt-sgi.h
index 15f355b..547b37a 100644
--- a/include/pt-sgi.h
+++ b/include/pt-sgi.h
@@ -99,8 +99,10 @@ static inline uint32_t sgi_pt_checksum(struct sgi_disklabel *label)
 
 	i = sizeof(*label) / sizeof(*ptr);
 
-	while (i--)
+	while (i) {
+		i--;
 		sum -= be32_to_cpu(ptr[i]);
+	}
 
 	return sum;
 }
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux