Skip to content

Commit 2453548

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent cce47b7 commit 2453548

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

kernel/fork.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,11 +2707,11 @@ __latent_entropy struct task_struct *copy_process(
27072707
hlist_del_init(&delayed.node);
27082708
spin_unlock_irq(&current->sighand->siglock);
27092709
/*
2710-
* The error path returns ERR_PTR(retval), which requires a negative
2711-
* errno. Normalize unexpected values to avoid returning non-error
2712-
* pointers to callers.
2710+
* The error path returns ERR_PTR(retval), which requires retval to be a
2711+
* negative errno in the range [-MAX_ERRNO, -1]. Normalize unexpected
2712+
* values to avoid returning non-error pointers to callers.
27132713
*/
2714-
if (unlikely(retval >= 0))
2714+
if (unlikely(retval >= 0 || retval < -MAX_ERRNO))
27152715
retval = -EINVAL;
27162716
return ERR_PTR(retval);
27172717
}

0 commit comments

Comments
 (0)