Skip to content

Commit

Permalink
[PATCH] coverity: i386: build.c: negative return to unsigned fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
KAMBAROV, ZAUR authored and Linus Torvalds committed Jun 29, 2005
1 parent 4cceb4d commit a8f5034
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/i386/boot/tools/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a8f5034

Please sign in to comment.