]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
reset: hisilicon: fix potential NULL pointer dereference
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Thu, 26 Jul 2018 00:47:19 +0000 (19:47 -0500)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:58:57 +0000 (19:58 -0600)
commit8b03c25c6a9009ec0fe043df5f5157391a656b84
tree2b612d4704481f48ec1a75a8c6d85a7907a83d31
parent167cc69f368ca20be2e02556147c94f14d7fde57
reset: hisilicon: fix potential NULL pointer dereference

BugLink: https://bugs.launchpad.net/bugs/1836802
commit e9a2310fb689151166df7fd9971093362d34bd79 upstream.

There is a potential execution path in which function
platform_get_resource() returns NULL. If this happens,
we will end up having a NULL pointer dereference.

Fix this by replacing devm_ioremap with devm_ioremap_resource,
which has the NULL check and the memory region request.

This code was detected with the help of Coccinelle.

Cc: stable@vger.kernel.org
Fixes: 97b7129cd2af ("reset: hisilicon: change the definition of hisi_reset_init")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/clk/hisilicon/reset.c