Skip to content

Commit

Permalink
vm_mapCopy: fix _map_force error check
Browse files Browse the repository at this point in the history
_map_force may return a value above 0 on error, when prot mismatch is
encountered.

JIRA: RTOS-953
  • Loading branch information
badochov committed Oct 16, 2024
1 parent fccdfe3 commit 67fecaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vm/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,8 @@ int vm_mapCopy(process_t *proc, vm_map_t *dst, vm_map_t *src)

if ((proc == NULL) || (proc->lazy == 0)) {
for (offs = 0; offs < f->size; offs += SIZE_PAGE) {
if ((_map_force(dst, f, f->vaddr + offs, f->prot) < 0) ||
(_map_force(src, e, e->vaddr + offs, e->prot) < 0)) {
if ((_map_force(dst, f, f->vaddr + offs, f->prot) != 0) ||
(_map_force(src, e, e->vaddr + offs, e->prot) != 0)) {
proc_lockClear(&dst->lock);
proc_lockClear(&src->lock);
return -ENOMEM;
Expand Down

0 comments on commit 67fecaa

Please sign in to comment.