linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ima: remove redundant initialization of pointer 'file'.
@ 2022-03-01 12:07 Colin Ian King
  2022-04-05 12:43 ` Mimi Zohar
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-03-01 12:07 UTC (permalink / raw)
  To: Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E . Hallyn,
	linux-integrity, linux-security-module
  Cc: kernel-janitors, linux-kernel, llvm

The pointer 'file' is being initialized with a value that is never read,
it is being re-assigned the same value later on closer to where it is
being first used. The initialization is redundant and can be removed.

Cleans up clang scan build warning:
security/integrity/ima/ima_main.c:434:15: warning: Value stored to 'file'
during its initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 security/integrity/ima/ima_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index c6412dec3810..41b91a0bc8dc 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -431,7 +431,7 @@ int ima_file_mmap(struct file *file, unsigned long prot)
 int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot)
 {
 	struct ima_template_desc *template = NULL;
-	struct file *file = vma->vm_file;
+	struct file *file;
 	char filename[NAME_MAX];
 	char *pathbuf = NULL;
 	const char *pathname = NULL;
-- 
2.34.1


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

* Re: [PATCH] ima: remove redundant initialization of pointer 'file'.
  2022-03-01 12:07 [PATCH] ima: remove redundant initialization of pointer 'file' Colin Ian King
@ 2022-04-05 12:43 ` Mimi Zohar
  0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2022-04-05 12:43 UTC (permalink / raw)
  To: Colin Ian King, Dmitry Kasatkin, James Morris, Serge E . Hallyn,
	linux-integrity, linux-security-module
  Cc: kernel-janitors, linux-kernel, llvm

On Tue, 2022-03-01 at 12:07 +0000, Colin Ian King wrote:
> The pointer 'file' is being initialized with a value that is never read,
> it is being re-assigned the same value later on closer to where it is
> being first used. The initialization is redundant and can be removed.
> 
> Cleans up clang scan build warning:
> security/integrity/ima/ima_main.c:434:15: warning: Value stored to 'file'
> during its initialization is never read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

thanks,

Mimi


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

end of thread, other threads:[~2022-04-05 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 12:07 [PATCH] ima: remove redundant initialization of pointer 'file' Colin Ian King
2022-04-05 12:43 ` Mimi Zohar

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