]> git.baikalelectronics.ru Git - kernel.git/commit
clk: vc5: Add memory check to prevent oops
authorAdam Ford <aford173@gmail.com>
Thu, 16 Jul 2020 12:26:20 +0000 (07:26 -0500)
committerStephen Boyd <sboyd@kernel.org>
Thu, 23 Jul 2020 01:47:57 +0000 (18:47 -0700)
commit5e80cc151fa58996beea97ccf5766c9571845963
tree541acf178b9e84945d38217aa835f879bdaf2cd1
parentde528a8c8aec6522222f79bb0825ae0949cd78aa
clk: vc5: Add memory check to prevent oops

When getting the names of the child nodes, kasprintf is used to
allocate memory which is used to create the string for the node
name.  Unfortunately, there is no memory check to determine
if this allocation fails, it may cause an error when trying
to get child node name.

This patch will check if the memory allocation fails, and returns
and -ENOMEM error instead of blindly moving on.

Fixes: 3bf579674fef ("clk: vc5: Enable addition output configurations of the Versaclock")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Link: https://lore.kernel.org/r/20200716122620.4538-1-aford173@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk-versaclock5.c