]> git.proxmox.com Git - mirror_qemu.git/blobdiff - linux-user/flatload.c
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
[mirror_qemu.git] / linux-user / flatload.c
index 42d1079a241ef96a653fb468cf6573a280325f1a..a35a560904917d086e52b97c8294e1d3e2d52e55 100644 (file)
@@ -95,7 +95,13 @@ static int target_pread(int fd, abi_ulong ptr, abi_ulong len,
     int ret;
 
     buf = lock_user(VERIFY_WRITE, ptr, len, 0);
+    if (!buf) {
+        return -EFAULT;
+    }
     ret = pread(fd, buf, len, offset);
+    if (ret < 0) {
+        ret = -errno;
+    }
     unlock_user(buf, ptr, len);
     return ret;
 }