Skip to contentSkip to conversation

seccomp: Remove unnecessary ‘NULL’ values from prepared

PATCH In review Li zeming 2 participants 2 messages Aug 24, 2023 Secure computing

lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 seccomp: Remove unnecessary ‘NULL’ values from prepared

prepared is assigned first, so it does not need to initialize the assignment.

---
 kernel/seccomp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/seccomp.c +1 -1
index d3e584065c7f..af672e03449a 100644
@@ -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;
Signature · 1 line
2.18.2
#1 lore raw
Quoted 2 lines · Li zeming

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

Signature · 1 line
Kees Cook