* Re: [PATCH] seccomp: Remove unnecessary ‘NULL’ values from prepared
2023-08-25 18:43 [PATCH] seccomp: Remove unnecessary ‘NULL’ values from prepared Li zeming
@ 2023-08-24 16:42 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2023-08-24 16:42 UTC (permalink / raw)
To: Li zeming; +Cc: luto, wad, linux-kernel
On Sat, Aug 26, 2023 at 02:43:48AM +0800, Li zeming wrote:
> prepared is assigned first, so it does not need to initialize the
> assignment.
I prefer to explicitly initialize variables so that later changes in
the code cannot suddenly leave a variable in a surprise state. :) The
compiler will do a good job removing redundant and dead stores.
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] seccomp: Remove unnecessary ‘NULL’ values from prepared
@ 2023-08-25 18:43 Li zeming
2023-08-24 16:42 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2023-08-25 18:43 UTC (permalink / raw)
To: keescook, luto, wad; +Cc: linux-kernel, Li zeming
prepared is assigned first, so it does not need to initialize the
assignment.
Signed-off-by: Li zeming <zeming@nfschina.com>
---
kernel/seccomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index d3e584065c7f..af672e03449a 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1838,7 +1838,7 @@ static long seccomp_set_mode_filter(unsigned int flags,
const char __user *filter)
{
const unsigned long seccomp_mode = SECCOMP_MODE_FILTER;
- struct seccomp_filter *prepared = NULL;
+ struct seccomp_filter *prepared;
long ret = -EINVAL;
int listener = -1;
struct file *listener_f = NULL;
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-24 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25 18:43 [PATCH] seccomp: Remove unnecessary ‘NULL’ values from prepared Li zeming
2023-08-24 16:42 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox