summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/core/loader.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c
index bf17b42cbe..f72930ca4a 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -611,8 +611,9 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,
return -1;
size = read(fd, hdr, sizeof(uboot_image_header_t));
- if (size < 0)
+ if (size < sizeof(uboot_image_header_t)) {
goto out;
+ }
bswap_uboot_header(hdr);