[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190530093937.GA4457@zhanggen-UX430UQ>
Date: Thu, 30 May 2019 17:39:37 +0800
From: Gen Zhang <blackgod016574@...il.com>
To: inaky.perez-gonzalez@...el.com
Cc: linux-wimax@...el.com, linux-kernel@...r.kernel.org
Subject: [PATCH] wimax: debug: fix a missing-check bug in d_parse_params()
In d_parse_params(), 'params_orig' is allocated by kstrdup(). It returns
NULL when fails. So 'params_orig' should be checked.
Signed-off-by: Gen Zhang <blackgod016574@...il.com>
---
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index aaf24ba..bacd6cb 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -496,6 +496,11 @@ void d_parse_params(struct d_level *d_level, size_t d_level_size,
if (_params == NULL)
return;
params_orig = kstrdup(_params, GFP_KERNEL);
+ if (!params_orig) {
+ printk(KERN_ERR "%s: can't duplicate string '%s'\n",
+ tag, _params);
+ return;
+ }
params = params_orig;
while (1) {
token = strsep(¶ms, " ");
Powered by blists - more mailing lists