mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-05 05:01:33 +00:00
kvm: Check for read() return value in load_bzimage()
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
34649df9e8
commit
7ada9b6b0e
@@ -298,7 +298,8 @@ static bool load_bzimage(struct kvm *self, int fd, const char *kernel_cmdline)
|
||||
if (lseek(fd, 0, SEEK_SET) < 0)
|
||||
die_perror("lseek");
|
||||
|
||||
read(fd, &boot, sizeof(boot));
|
||||
if (read(fd, &boot, sizeof(boot)) != sizeof(boot))
|
||||
die_perror("read");
|
||||
|
||||
if (memcmp(&boot.hdr.header, BZIMAGE_MAGIC, strlen(BZIMAGE_MAGIC)) != 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user