mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mdesc: fix a missing-check bug in get_vdev_port_node_info()
@ 2019-05-31  1:24 Gen Zhang
  2019-06-03  5:15 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Gen Zhang @ 2019-05-31  1:24 UTC (permalink / raw)
  To: davem, rppt, mhocko, akpm, sfr; +Cc: sparclinux, linux-kernel

In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated
by kstrdup_const(), and it returns NULL when fails. So 
'node_info->vdev_port.name' should be checked.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
---
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 9a26b44..8e645dd 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -356,6 +356,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node,
 
 	node_info->vdev_port.id = *idp;
 	node_info->vdev_port.name = kstrdup_const(name, GFP_KERNEL);
+	if (!node_info->vdev_port.name)
+		return -1;
 	node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp;
 
 	return 0;
---

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] mdesc: fix a missing-check bug in get_vdev_port_node_info()
@ 2019-05-27  3:25 Gen Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Gen Zhang @ 2019-05-27  3:25 UTC (permalink / raw)
  To: davem, rppt, akpm, mhocko, sfr; +Cc: sparclinux, linux-kernel

In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated
by kstrdup_const(), and it returns NULL when fails. So 
'node_info->vdev_port.name' should be checked.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
---
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 9a26b44..8e645dd 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -356,6 +356,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node,
 
 	node_info->vdev_port.id = *idp;
 	node_info->vdev_port.name = kstrdup_const(name, GFP_KERNEL);
+	if (!node_info->vdev_port.name)
+		return -1;
 	node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp;
 
 	return 0;
---

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  1:24 [PATCH] mdesc: fix a missing-check bug in get_vdev_port_node_info() Gen Zhang
2019-06-03  5:15 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2019-05-27  3:25 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®