Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Sachin Kamat
On 12 September 2013 14:26, Viresh Kumar wrote: > On 12 September 2013 13:52, Sachin Kamat wrote: >> sdhci_probe only checks for IS_ERR. We would need to change it to >> IS_ERR_OR_NULL (which I do not prefer personally as there is some >> discussion for its removal). In that case we would need to

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Viresh Kumar
On 12 September 2013 13:52, Sachin Kamat wrote: > sdhci_probe only checks for IS_ERR. We would need to change it to > IS_ERR_OR_NULL (which I do not prefer personally as there is some > discussion for its removal). In that case we would need to return as I > mentioned in my earlier email. Let me k

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Sachin Kamat
On 12 September 2013 13:50, Viresh Kumar wrote: > On 12 September 2013 13:48, Sachin Kamat wrote: 96 return ERR_PTR(-ENODATA); >> >> Wouldn't this be unconditional error return whether pdata is null or not? > > Stupid me... I meant return pdata from this place.. > > Necessary checks ar

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Viresh Kumar
On 12 September 2013 13:48, Sachin Kamat wrote: >>> 96 return ERR_PTR(-ENODATA); > > Wouldn't this be unconditional error return whether pdata is null or not? Stupid me... I meant return pdata from this place.. Necessary checks are done in sdhci_probe() -- To unsubscribe from this list: se

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Sachin Kamat
On 12 September 2013 13:43, Viresh Kumar wrote: > On 12 September 2013 13:41, Sachin Kamat wrote: >> Yes. That was my second option. If we do that we would get something as >> below: >> >> 84 /* If pdata is required */ >> 85 if (cd_gpio != -1) { >> 86pdata = de

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Viresh Kumar
On 12 September 2013 13:41, Sachin Kamat wrote: > Yes. That was my second option. If we do that we would get something as below: > > 84 /* If pdata is required */ > 85 if (cd_gpio != -1) { > 86pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), > GFP_KERNEL); > 87

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Sachin Kamat
On 12 September 2013 13:19, Viresh Kumar wrote: > On 12 September 2013 12:13, Sachin Kamat wrote: >> pdata could be NULL if cd_gpio = -1. Hence move the NULL check >> outside the if condition. >> >> Signed-off-by: Sachin Kamat >> Cc: Viresh Kumar >> --- >> Only compile tested. >> --- >> driver

Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Viresh Kumar
On 12 September 2013 12:13, Sachin Kamat wrote: > pdata could be NULL if cd_gpio = -1. Hence move the NULL check > outside the if condition. > > Signed-off-by: Sachin Kamat > Cc: Viresh Kumar > --- > Only compile tested. > --- > drivers/mmc/host/sdhci-spear.c | 10 +- > 1 file changed

[PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

2013-09-12 Thread Sachin Kamat
pdata could be NULL if cd_gpio = -1. Hence move the NULL check outside the if condition. Signed-off-by: Sachin Kamat Cc: Viresh Kumar --- Only compile tested. --- drivers/mmc/host/sdhci-spear.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdh