mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wimax: debug: fix a missing-check bug in d_parse_params()
@ 2019-05-30  9:39 Gen Zhang
  2019-06-05  6:33 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Gen Zhang @ 2019-05-30  9:39 UTC (permalink / raw)
  To: inaky.perez-gonzalez; +Cc: linux-wimax, linux-kernel

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@gmail.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(&params, " ");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-05 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30  9:39 [PATCH] wimax: debug: fix a missing-check bug in d_parse_params() Gen Zhang
2019-06-05  6:33 ` Jiri Slaby
2019-06-05 16:11   ` Gen Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®