From ae3f281ed22d74530c4a1a51462f372f638e4764 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Thu, 26 Jan 2017 15:18:23 -0700 Subject: sysctl: fix maybe-uninitialized warnings kernel/sysctl.c: In function '__do_proc_dointvec.isra.3': kernel/sysctl.c:2030:8: warning: 'kbuf' may be used uninitialized in this function [-Wmaybe-uninitialized] char *tmp = skip_spaces(*buf); ^~~ kernel/sysctl.c:2183:8: note: 'kbuf' was declared here char *kbuf; ^~~~ kernel/sysctl.c: In function '__do_proc_doulongvec_minmax': kernel/sysctl.c:2030:8: warning: 'kbuf' may be used uninitialized in this function [-Wmaybe-uninitialized] char *tmp = skip_spaces(*buf); ^~~ kernel/sysctl.c:2433:8: note: 'kbuf' was declared here char *kbuf; ^~~~ This will be initialized to NULL normally. Signed-off-by: Nathan Chancellor --- kernel/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kernel') diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 85d56cf97..4757d481b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2006,7 +2006,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, int *i, vleft, first = 1, err = 0; unsigned long page = 0; size_t left; - char *kbuf; + char *kbuf = NULL; if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; @@ -2256,7 +2256,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int int vleft, first = 1, err = 0; unsigned long page = 0; size_t left; - char *kbuf; + char *kbuf = NULL; if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; -- cgit v1.2.3