linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] secretmem: drop unneeded initialization in secretmem_file_create()
@ 2022-07-04  9:26 Lukas Bulwahn
  2022-07-04 14:51 ` Tom Rix
  2022-07-04 16:30 ` Mike Rapoport
  0 siblings, 2 replies; 4+ messages in thread
From: Lukas Bulwahn @ 2022-07-04  9:26 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton, linux-mm
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, llvm,
	kernel-janitors, linux-kernel, Lukas Bulwahn

Drop the unneeded initialization of the local variable file in function
secretmem_file_create().

No functional change and no change in the resulting object code.

This unneeded initialization was already introduced with the introduction
of secretmem in commit 1507f51255c9 ("mm: introduce memfd_secret system
call to create "secret" memory areas"). This minor code-stylistic issue
was discovered as a dead store with clang-analyzer.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
Mike, please ack.

Andrew, please pick this minor stylistic clean-up patch. Thanks.

 mm/secretmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/secretmem.c b/mm/secretmem.c
index 7584aab54d20..46b431d62761 100644
--- a/mm/secretmem.c
+++ b/mm/secretmem.c
@@ -171,7 +171,7 @@ static struct vfsmount *secretmem_mnt;
 
 static struct file *secretmem_file_create(unsigned long flags)
 {
-	struct file *file = ERR_PTR(-ENOMEM);
+	struct file *file;
 	struct inode *inode;
 	const char *anon_name = "[secretmem]";
 	const struct qstr qname = QSTR_INIT(anon_name, strlen(anon_name));
-- 
2.17.1


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

* Re: [PATCH] secretmem: drop unneeded initialization in secretmem_file_create()
  2022-07-04  9:26 [PATCH] secretmem: drop unneeded initialization in secretmem_file_create() Lukas Bulwahn
@ 2022-07-04 14:51 ` Tom Rix
  2022-07-04 16:30 ` Mike Rapoport
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rix @ 2022-07-04 14:51 UTC (permalink / raw)
  To: Lukas Bulwahn, Mike Rapoport, Andrew Morton, linux-mm
  Cc: Nathan Chancellor, Nick Desaulniers, llvm, kernel-janitors, linux-kernel


On 7/4/22 2:26 AM, Lukas Bulwahn wrote:
> Drop the unneeded initialization of the local variable file in function
> secretmem_file_create().
>
> No functional change and no change in the resulting object code.
>
> This unneeded initialization was already introduced with the introduction
> of secretmem in commit 1507f51255c9 ("mm: introduce memfd_secret system
> call to create "secret" memory areas").

You may need to be more specific about this commit, the whole function, 
including this initialization was introduced at this time.

Otherwise, change looks fine.

Reviewed-by: Tom Rix <trix@redhat.com>

>   This minor code-stylistic issue
> was discovered as a dead store with clang-analyzer.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Mike, please ack.
>
> Andrew, please pick this minor stylistic clean-up patch. Thanks.
>
>   mm/secretmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/secretmem.c b/mm/secretmem.c
> index 7584aab54d20..46b431d62761 100644
> --- a/mm/secretmem.c
> +++ b/mm/secretmem.c
> @@ -171,7 +171,7 @@ static struct vfsmount *secretmem_mnt;
>   
>   static struct file *secretmem_file_create(unsigned long flags)
>   {
> -	struct file *file = ERR_PTR(-ENOMEM);
> +	struct file *file;
>   	struct inode *inode;
>   	const char *anon_name = "[secretmem]";
>   	const struct qstr qname = QSTR_INIT(anon_name, strlen(anon_name));


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

* Re: [PATCH] secretmem: drop unneeded initialization in secretmem_file_create()
  2022-07-04  9:26 [PATCH] secretmem: drop unneeded initialization in secretmem_file_create() Lukas Bulwahn
  2022-07-04 14:51 ` Tom Rix
@ 2022-07-04 16:30 ` Mike Rapoport
  2022-07-05  6:05   ` Lukas Bulwahn
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Rapoport @ 2022-07-04 16:30 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Andrew Morton, linux-mm, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, llvm, kernel-janitors, linux-kernel

Hi Lukas,

On Mon, Jul 04, 2022 at 11:26:05AM +0200, Lukas Bulwahn wrote:
> Drop the unneeded initialization of the local variable file in function
> secretmem_file_create().
> 
> No functional change and no change in the resulting object code.
> 
> This unneeded initialization was already introduced with the introduction
> of secretmem in commit 1507f51255c9 ("mm: introduce memfd_secret system
> call to create "secret" memory areas"). This minor code-stylistic issue
> was discovered as a dead store with clang-analyzer.

You are right and in the current code the initialization is unneeded, but
there's a pending patch that relies of this initialization:

https://lore.kernel.org/all/Yr1jKwz2+SGxjcuW@kernel.org/

Let's wait and see how that fix develops.

> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Mike, please ack.
> 
> Andrew, please pick this minor stylistic clean-up patch. Thanks.
> 
>  mm/secretmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/secretmem.c b/mm/secretmem.c
> index 7584aab54d20..46b431d62761 100644
> --- a/mm/secretmem.c
> +++ b/mm/secretmem.c
> @@ -171,7 +171,7 @@ static struct vfsmount *secretmem_mnt;
>  
>  static struct file *secretmem_file_create(unsigned long flags)
>  {
> -	struct file *file = ERR_PTR(-ENOMEM);
> +	struct file *file;
>  	struct inode *inode;
>  	const char *anon_name = "[secretmem]";
>  	const struct qstr qname = QSTR_INIT(anon_name, strlen(anon_name));
> -- 
> 2.17.1
> 

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] secretmem: drop unneeded initialization in secretmem_file_create()
  2022-07-04 16:30 ` Mike Rapoport
@ 2022-07-05  6:05   ` Lukas Bulwahn
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Bulwahn @ 2022-07-05  6:05 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Andrew Morton, Linux-MM, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, llvm, kernel-janitors, Linux Kernel Mailing List

On Mon, Jul 4, 2022 at 6:30 PM Mike Rapoport <rppt@linux.ibm.com> wrote:
>
> Hi Lukas,
>
> On Mon, Jul 04, 2022 at 11:26:05AM +0200, Lukas Bulwahn wrote:
> > Drop the unneeded initialization of the local variable file in function
> > secretmem_file_create().
> >
> > No functional change and no change in the resulting object code.
> >
> > This unneeded initialization was already introduced with the introduction
> > of secretmem in commit 1507f51255c9 ("mm: introduce memfd_secret system
> > call to create "secret" memory areas"). This minor code-stylistic issue
> > was discovered as a dead store with clang-analyzer.
>
> You are right and in the current code the initialization is unneeded, but
> there's a pending patch that relies of this initialization:
>
> https://lore.kernel.org/all/Yr1jKwz2+SGxjcuW@kernel.org/
>
> Let's wait and see how that fix develops.
>

Agree. I will continue tracking the evolution of this function and
resend my patch if this patch above does not land in the next six
months. For now, this clean-up patch here can be ignored.

Lukas

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

end of thread, other threads:[~2022-07-05  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04  9:26 [PATCH] secretmem: drop unneeded initialization in secretmem_file_create() Lukas Bulwahn
2022-07-04 14:51 ` Tom Rix
2022-07-04 16:30 ` Mike Rapoport
2022-07-05  6:05   ` Lukas Bulwahn

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).