[alsa-devel] [PATCH 1/2] slimbus: qcom-ctrl: fix a NULL test
"retries" ends when it is set to -1 and not 0 so that part of the test is wrong. This bug would lead to a NULL dereference a couple lines later.
Fixes: afbdcc7c384b ("slimbus: Add messaging APIs to slimbus framework") Signed-off-by: Dan Carpenter dan.carpenter@oracle.com --- Should Greg be added to the MAINTAINERS file for this driver?
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index fb1a5e0eb8dd..3ab59209cbdc 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl, } }
- if (!retries && !pbuf) + if (!pbuf) return -ENOMEM;
puc = (u8 *)pbuf;
devm_ioremap_resource() returns error pointers, not NULL so the check needs to be fixed.
Fixes: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver") Signed-off-by: Dan Carpenter dan.carpenter@oracle.com
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index 3ab59209cbdc..6bf95bf33299 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -528,9 +528,9 @@ static int qcom_slim_probe(struct platform_device *pdev)
slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem); - if (!ctrl->base) { + if (IS_ERR(ctrl->base)) { dev_err(&pdev->dev, "IOremap failed\n"); - return -ENOMEM; + return PTR_ERR(ctrl->base); }
sctrl->set_laddr = qcom_set_laddr;
On 09/01/18 09:26, Dan Carpenter wrote:
devm_ioremap_resource() returns error pointers, not NULL so the check needs to be fixed.
Fixes: ad7fcbc308b0 ("slimbus: qcom: Add Qualcomm Slimbus controller driver") Signed-off-by: Dan Carpenter dan.carpenter@oracle.com
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index 3ab59209cbdc..6bf95bf33299 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -528,9 +528,9 @@ static int qcom_slim_probe(struct platform_device *pdev)
slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem);
- if (!ctrl->base) {
- if (IS_ERR(ctrl->base)) { dev_err(&pdev->dev, "IOremap failed\n");
return -ENOMEM;
return PTR_ERR(ctrl->base);
}
sctrl->set_laddr = qcom_set_laddr;
Already fixed at:
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1575797.html
On 09/01/18 09:26, Dan Carpenter wrote:
"retries" ends when it is set to -1 and not 0 so that part of the test is wrong. This bug would lead to a NULL dereference a couple lines later.
Fixes: afbdcc7c384b ("slimbus: Add messaging APIs to slimbus framework") Signed-off-by: Dan Carpenter dan.carpenter@oracle.com
Should Greg be added to the MAINTAINERS file for this driver?
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index fb1a5e0eb8dd..3ab59209cbdc 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -345,7 +345,7 @@ static int qcom_xfer_msg(struct slim_controller *sctrl, } }
- if (!retries && !pbuf)
if (!pbuf) return -ENOMEM;
puc = (u8 *)pbuf;
Already fixed at: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1575799.html
participants (2)
-
Dan Carpenter
-
Srinivas Kandagatla