From: Sami Kerola Date: Sat, 22 Nov 2014 08:13:59 +0000 (+0000) Subject: fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] X-Git-Tag: v2.26-rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=737532efe5a931cf452564624da430ee8e2110eb;p=thirdparty%2Futil-linux.git fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] 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 --- diff --git a/include/pt-sgi.h b/include/pt-sgi.h index 15f355b84c..547b37a872 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; }