Since insertion of empty memory regions should not happen, return
`-EINVAL` in case the program does somehow end up doing this.
This way we will know early on if a memregion computation is wrong
or if we are met with an unhandled edge case.
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1060
struct ukplat_memregion_desc *p;
__u32 i;
+ if (unlikely(!mrd->len))
+ return -EINVAL;
+
if (unlikely(list->count == list->capacity))
return -ENOMEM;
{
struct ukplat_memregion_desc *p;
+ if (unlikely(!mrd->len))
+ return -EINVAL;
+
if (unlikely(list->count == list->capacity))
return -ENOMEM;
int i;
int rc;
+ if (unlikely(!mrd->len))
+ return -EINVAL;
+
voffset = mrd->vbase - mrd->pbase;
pstart = mrd->pbase;
pend = mrd->pbase + mrd->len;