* [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference
@ 2013-09-12 8:21 Sachin Kamat
2013-09-12 18:43 ` Tony Prisk
2013-10-21 3:09 ` Sachin Kamat
0 siblings, 2 replies; 4+ messages in thread
From: Sachin Kamat @ 2013-09-12 8:21 UTC (permalink / raw)
To: linux-mmc; +Cc: cjb, linux, sachin.kamat
'of_id' is dereferenced before NULL pointer check. Move it to
after the check.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested.
---
drivers/mmc/host/wmt-sdmmc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 34231d5..3523a72 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -771,7 +771,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id =
of_match_device(wmt_mci_dt_ids, &pdev->dev);
- const struct wmt_mci_caps *wmt_caps = of_id->data;
+ const struct wmt_mci_caps *wmt_caps;
int ret;
int regular_irq, dma_irq;
@@ -780,6 +780,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
return -EFAULT;
}
+ wmt_caps = of_id->data;
+
if (!np) {
dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n");
return -EFAULT;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference
2013-09-12 8:21 [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference Sachin Kamat
@ 2013-09-12 18:43 ` Tony Prisk
2013-09-27 9:40 ` Sachin Kamat
2013-10-21 3:09 ` Sachin Kamat
1 sibling, 1 reply; 4+ messages in thread
From: Tony Prisk @ 2013-09-12 18:43 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-mmc, cjb
On 12/09/13 20:21, Sachin Kamat wrote:
> 'of_id' is dereferenced before NULL pointer check. Move it to
> after the check.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested.
> ---
> drivers/mmc/host/wmt-sdmmc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 34231d5..3523a72 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -771,7 +771,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
> struct device_node *np = pdev->dev.of_node;
> const struct of_device_id *of_id =
> of_match_device(wmt_mci_dt_ids, &pdev->dev);
> - const struct wmt_mci_caps *wmt_caps = of_id->data;
> + const struct wmt_mci_caps *wmt_caps;
> int ret;
> int regular_irq, dma_irq;
>
> @@ -780,6 +780,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
> return -EFAULT;
> }
>
> + wmt_caps = of_id->data;
> +
> if (!np) {
> dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n");
> return -EFAULT;
While I don't mind either way, this can never fail anyway. arch-vt8500
is devicetree only, so the only way the driver will get probed is
through a compatible-match, and .data must be (and is) specified.
I guess it's still good housekeeping to test it to protect future
changes so:
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Regards
Tony P
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference
2013-09-12 18:43 ` Tony Prisk
@ 2013-09-27 9:40 ` Sachin Kamat
0 siblings, 0 replies; 4+ messages in thread
From: Sachin Kamat @ 2013-09-27 9:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc
On 13 September 2013 00:13, Tony Prisk <linux@prisktech.co.nz> wrote:
> On 12/09/13 20:21, Sachin Kamat wrote:
>>
>> 'of_id' is dereferenced before NULL pointer check. Move it to
>> after the check.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>> Compile tested.
>> ---
>> drivers/mmc/host/wmt-sdmmc.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
>> index 34231d5..3523a72 100644
>> --- a/drivers/mmc/host/wmt-sdmmc.c
>> +++ b/drivers/mmc/host/wmt-sdmmc.c
>> @@ -771,7 +771,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
>> struct device_node *np = pdev->dev.of_node;
>> const struct of_device_id *of_id =
>> of_match_device(wmt_mci_dt_ids, &pdev->dev);
>> - const struct wmt_mci_caps *wmt_caps = of_id->data;
>> + const struct wmt_mci_caps *wmt_caps;
>> int ret;
>> int regular_irq, dma_irq;
>> @@ -780,6 +780,8 @@ static int wmt_mci_probe(struct platform_device
>> *pdev)
>> return -EFAULT;
>> }
>> + wmt_caps = of_id->data;
>> +
>> if (!np) {
>> dev_err(&pdev->dev, "Missing SDMMC description in
>> devicetree\n");
>> return -EFAULT;
>
>
> While I don't mind either way, this can never fail anyway. arch-vt8500 is
> devicetree only, so the only way the driver will get probed is through a
> compatible-match, and .data must be (and is) specified.
>
> I guess it's still good housekeeping to test it to protect future changes
> so:
>
> Acked-by: Tony Prisk <linux@prisktech.co.nz>
Ping Chris.
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference
2013-09-12 8:21 [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference Sachin Kamat
2013-09-12 18:43 ` Tony Prisk
@ 2013-10-21 3:09 ` Sachin Kamat
1 sibling, 0 replies; 4+ messages in thread
From: Sachin Kamat @ 2013-10-21 3:09 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Sachin Kamat
On 12 September 2013 13:51, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> 'of_id' is dereferenced before NULL pointer check. Move it to
> after the check.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested.
> ---
> drivers/mmc/host/wmt-sdmmc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 34231d5..3523a72 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -771,7 +771,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
> struct device_node *np = pdev->dev.of_node;
> const struct of_device_id *of_id =
> of_match_device(wmt_mci_dt_ids, &pdev->dev);
> - const struct wmt_mci_caps *wmt_caps = of_id->data;
> + const struct wmt_mci_caps *wmt_caps;
> int ret;
> int regular_irq, dma_irq;
>
> @@ -780,6 +780,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
> return -EFAULT;
> }
>
> + wmt_caps = of_id->data;
> +
> if (!np) {
> dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n");
> return -EFAULT;
> --
> 1.7.9.5
>
Gentle ping...
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-21 3:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 8:21 [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference Sachin Kamat
2013-09-12 18:43 ` Tony Prisk
2013-09-27 9:40 ` Sachin Kamat
2013-10-21 3:09 ` Sachin Kamat
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.