]> err.no Git - linux-2.6/commitdiff
[PATCH] coverity: i386: build.c: negative return to unsigned fix
authorKAMBAROV, ZAUR <kambarov@berkeley.edu>
Wed, 29 Jun 2005 03:45:06 +0000 (20:45 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 29 Jun 2005 04:20:33 +0000 (21:20 -0700)
Variable "c" was declared as an unsigned int, but used in:

125   for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
126   if (write(1, buf, c) != c)
127   die("Write call failed");

(akpm: read() can return -1.  If it does, we fill the disk up with garbage).

Signed-off-by: Zaur Kambarov <zkambarov@coverity.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/boot/tools/build.c

index 4a17956512e1a279d1ea28f4209748df509b151a..6835f6d47c31e8f5913a670c6bd7bdd57f1e7b7c 100644 (file)
@@ -70,7 +70,8 @@ void usage(void)
 
 int main(int argc, char ** argv)
 {
-       unsigned int i, c, sz, setup_sectors;
+       unsigned int i, sz, setup_sectors;
+       int c;
        u32 sys_size;
        byte major_root, minor_root;
        struct stat sb;