public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] init: mark envp_init as static
@ 2025-11-28 19:16 Sameeksha Sankpal
  2025-11-30  9:38 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Sameeksha Sankpal @ 2025-11-28 19:16 UTC (permalink / raw)
  To: akpm
  Cc: rppt, tglx, chenhuacai, mhiramat, mingo, francesco, link, brauner,
	lillian, guoweikang.kernel, alexander.shishkin, linux-kernel,
	Sameeksha Sankpal

Sparse reports a warning that 'envp_init' has no prior
declaration:

  warning: symbol 'envp_init' was not declared. Should it be static?

The variable is only used within init/main.c and does not
need external linkage. Mark it as static to limit its scope
and fix the sparse warning.

Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 07a3116811c5..792ab00e62e6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -191,7 +191,7 @@ static int __init set_reset_devices(char *str)
 __setup("reset_devices", set_reset_devices);
 
 static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
-const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
+static const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
 static const char *panic_later, *panic_param;
 
 static bool __init obsolete_checksetup(char *line)
-- 
2.43.0


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

* Re: [PATCH] init: mark envp_init as static
  2025-11-28 19:16 [PATCH] init: mark envp_init as static Sameeksha Sankpal
@ 2025-11-30  9:38 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2025-11-30  9:38 UTC (permalink / raw)
  To: Sameeksha Sankpal
  Cc: akpm, tglx, chenhuacai, mhiramat, mingo, francesco, link, brauner,
	lillian, guoweikang.kernel, alexander.shishkin, linux-kernel

On Sat, Nov 29, 2025 at 12:46:50AM +0530, Sameeksha Sankpal wrote:
> Sparse reports a warning that 'envp_init' has no prior
> declaration:
> 
>   warning: symbol 'envp_init' was not declared. Should it be static?
> 
> The variable is only used within init/main.c and does not
> need external linkage. Mark it as static to limit its scope
> and fix the sparse warning.

It's used in do_mounts_initrd::handle_initrd()

> 
> Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
> ---
>  init/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/init/main.c b/init/main.c
> index 07a3116811c5..792ab00e62e6 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -191,7 +191,7 @@ static int __init set_reset_devices(char *str)
>  __setup("reset_devices", set_reset_devices);
>  
>  static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
> -const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
> +static const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
>  static const char *panic_later, *panic_param;
>  
>  static bool __init obsolete_checksetup(char *line)
> -- 
> 2.43.0
> 

-- 
Sincerely yours,
Mike.

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

end of thread, other threads:[~2025-11-30  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 19:16 [PATCH] init: mark envp_init as static Sameeksha Sankpal
2025-11-30  9:38 ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox