fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
In the setup_arg_pages(), ret is declared as an unsigned long.
The ret might take a negative value. Therefore, its type should
be changed to int.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
fs/exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/exec.c b/fs/exec.c
index 2a1e5e4042a1..5d236bb87df5 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -599,7 +599,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
unsigned long stack_top,
int executable_stack)
{
- unsigned long ret;
+ int ret;
unsigned long stack_shift;
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma = bprm->vma;
--
2.34.1
On Mon, 25 Aug 2025 15:36:09 +0800, Xichao Zhao wrote: > In the setup_arg_pages(), ret is declared as an unsigned long. > The ret might take a negative value. Therefore, its type should > be changed to int. > > Applied to for-next/execve, thanks! [1/1] exec: Fix incorrect type for ret https://git.kernel.org/kees/c/5e088248375d Take care, -- Kees Cook
… > The ret might take a negative value. Therefore, its type should > be changed to int. See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc3#n94 Regards, Markus
On Mon 25-08-25 15:36:09, Xichao Zhao wrote: > In the setup_arg_pages(), ret is declared as an unsigned long. > The ret might take a negative value. Therefore, its type should > be changed to int. > > Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com> Indeed, all three functions for which it is used are returning int. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/exec.c b/fs/exec.c > index 2a1e5e4042a1..5d236bb87df5 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -599,7 +599,7 @@ int setup_arg_pages(struct linux_binprm *bprm, > unsigned long stack_top, > int executable_stack) > { > - unsigned long ret; > + int ret; > unsigned long stack_shift; > struct mm_struct *mm = current->mm; > struct vm_area_struct *vma = bprm->vma; > -- > 2.34.1 > -- Jan Kara <jack@suse.com> SUSE Labs, CR
LGTM On 8/25/2025 11:36 AM, Xichao Zhao wrote: > In the setup_arg_pages(), ret is declared as an unsigned long. > The ret might take a negative value. Therefore, its type should > be changed to int. > > Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com> > --- > fs/exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/exec.c b/fs/exec.c > index 2a1e5e4042a1..5d236bb87df5 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -599,7 +599,7 @@ int setup_arg_pages(struct linux_binprm *bprm, > unsigned long stack_top, > int executable_stack) > { > - unsigned long ret; > + int ret; > unsigned long stack_shift; > struct mm_struct *mm = current->mm; > struct vm_area_struct *vma = bprm->vma;
© 2016 - 2025 Red Hat, Inc.