linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exec: Fix incorrect type for ret
@ 2025-08-25  7:36 Xichao Zhao
  2025-08-25  8:28 ` Giorgi Tchankvetadze
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Xichao Zhao @ 2025-08-25  7:36 UTC (permalink / raw)
  To: kees, viro, brauner
  Cc: jack, linux-mm, linux-fsdevel, linux-kernel, Xichao Zhao

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] exec: Fix incorrect type for ret
  2025-08-25  7:36 [PATCH] exec: Fix incorrect type for ret Xichao Zhao
@ 2025-08-25  8:28 ` Giorgi Tchankvetadze
  2025-08-25 12:38 ` Jan Kara
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Giorgi Tchankvetadze @ 2025-08-25  8:28 UTC (permalink / raw)
  To: Xichao Zhao, kees, viro, brauner
  Cc: jack, linux-mm, linux-fsdevel, linux-kernel

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;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exec: Fix incorrect type for ret
  2025-08-25  7:36 [PATCH] exec: Fix incorrect type for ret Xichao Zhao
  2025-08-25  8:28 ` Giorgi Tchankvetadze
@ 2025-08-25 12:38 ` Jan Kara
  2025-08-25 16:18 ` Markus Elfring
  2025-08-25 16:34 ` Kees Cook
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2025-08-25 12:38 UTC (permalink / raw)
  To: Xichao Zhao
  Cc: kees, viro, brauner, jack, linux-mm, linux-fsdevel, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exec: Fix incorrect type for ret
  2025-08-25  7:36 [PATCH] exec: Fix incorrect type for ret Xichao Zhao
  2025-08-25  8:28 ` Giorgi Tchankvetadze
  2025-08-25 12:38 ` Jan Kara
@ 2025-08-25 16:18 ` Markus Elfring
  2025-08-25 16:34 ` Kees Cook
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2025-08-25 16:18 UTC (permalink / raw)
  To: Xichao Zhao, linux-fsdevel, linux-mm
  Cc: LKML, Christian Brauner, Jan Kara, Kees Cook, Alexander Viro

…
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exec: Fix incorrect type for ret
  2025-08-25  7:36 [PATCH] exec: Fix incorrect type for ret Xichao Zhao
                   ` (2 preceding siblings ...)
  2025-08-25 16:18 ` Markus Elfring
@ 2025-08-25 16:34 ` Kees Cook
  3 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2025-08-25 16:34 UTC (permalink / raw)
  To: viro, brauner, Xichao Zhao
  Cc: Kees Cook, jack, linux-mm, linux-fsdevel, linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-25 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25  7:36 [PATCH] exec: Fix incorrect type for ret Xichao Zhao
2025-08-25  8:28 ` Giorgi Tchankvetadze
2025-08-25 12:38 ` Jan Kara
2025-08-25 16:18 ` Markus Elfring
2025-08-25 16:34 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).