Re: [PATCH] sparc: vDSO: Silence an uninitialized variable warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/13/2018 3:26 AM, Dan Carpenter wrote:
Smatch complains that "val" would be uninitialized if kstrtoul() fails.

Fixes: 9a08862a5d2e ("vDSO for sparc")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
  arch/sparc/vdso/vma.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/vdso/vma.c b/arch/sparc/vdso/vma.c
index f51595f861b8..5eaff3c1aa0c 100644
--- a/arch/sparc/vdso/vma.c
+++ b/arch/sparc/vdso/vma.c
@@ -262,7 +262,9 @@ static __init int vdso_setup(char *s)
  	unsigned long val;
err = kstrtoul(s, 10, &val);
+	if (err)
+		return err;
  	vdso_enabled = val;
-	return err;
+	return 0;
  }
  __setup("vdso=", vdso_setup);


This is probably fine, but it might be cleaner as

   	err = kstrtoul(s, 10, &val);
	if (!err)
		vdso_enabled = val;
	return err;

sln



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux