Skip to content

Commit

Permalink
mdesc: fix a missing-check bug in get_vdev_port_node_info()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gen Zhang authored and David S. Miller committed Jun 3, 2019
1 parent d3c976c commit 80caf43
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/sparc/kernel/mdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 80caf43

Please sign in to comment.