Skip to contentSkip to conversation

exec: Remove unnecessary ‘NULL’ values from vma

PATCH In review Li zeming 2 participants 2 messages Feb 20, 2024 – Feb 24, 2024

Subsystems (3)
lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 exec: Remove unnecessary ‘NULL’ values from vma

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

---
 fs/exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c +1 -1
index af4fbb61cd53e..7be0527f5ff25 100644
@@ -254,7 +254,7 @@ static void flush_arg_page(struct linux_binprm *bprm, unsigned long pos,
 static int __bprm_mm_init(struct linux_binprm *bprm)
 {
 	int err;
-	struct vm_area_struct *vma = NULL;
+	struct vm_area_struct *vma;
 	struct mm_struct *mm = bprm->mm;
 
 	bprm->vma = vma = vm_area_alloc(mm);
Signature · 1 line
2.18.2
#1 lore raw
Quoted 2 lines · Li zeming

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

I don't really like removing explicit initializations. They don't cause any problems and the compiler will remove redundant stores, so there's no benefit in dropping them.

Signature · 1 line
Kees Cook