search for: kernel_fd

Displaying 1 result from an estimated 1 matches for "kernel_fd".

2005 Feb 19
0
[PATCH] check read/write return values
...SEEK_END); if ( sig == 0x8b1f ) /* GZIP signature? */ { lseek(fd, -4, SEEK_END); - read(fd, &_sz, 4); + if ( read(fd, &_sz, 4) != 4 ) + return 0; sz = _sz; } lseek(fd, 0, SEEK_SET); @@ -304,6 +306,12 @@ *size = xc_get_filesz(kernel_fd); + if ( *size == 0 ) + { + PERROR("Could not read kernel image"); + goto out; + } + if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL ) { PERROR("Could not allocate decompression state for state file"); --- xen-unstable...