]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]
authorSami Kerola <kerolasa@iki.fi>
Sat, 22 Nov 2014 08:13:59 +0000 (08:13 +0000)
committerSami Kerola <kerolasa@iki.fi>
Fri, 19 Dec 2014 09:10:48 +0000 (09:10 +0000)
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@iki.fi>
include/pt-sgi.h

index 15f355b84c5437eaaa4055541a6db9dd93238996..547b37a872ae7a3c6592c3c5b89b716f24ecdb8c 100644 (file)
@@ -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;
 }