From: Jan Kiszka <[email protected]>

We currently fail if a load request has a size of 0, because mapping an
empty region fails. While such requests are often caused by corrupted
files there may also be valid use cases. So better handle this
gracefully.

Signed-off-by: Jan Kiszka <[email protected]>
---
 driver/cell.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/driver/cell.c b/driver/cell.c
index fcd9426..8a9ae26 100644
--- a/driver/cell.c
+++ b/driver/cell.c
@@ -275,6 +275,9 @@ static int load_image(struct cell *cell,
        if (copy_from_user(&image, uimage, sizeof(image)))
                return -EFAULT;
 
+       if (image.size == 0)
+               return 0;
+
        mem = cell->memory_regions;
        for (regions = cell->num_memory_regions; regions > 0; regions--) {
                image_offset = image.target_address - mem->virt_start;
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to