LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drivers: scsi: ufs: Fix possible null derefrence
@ 2015-03-04 12:49 Tapasweni Pathak
2015-03-10 10:28 ` Gilad Broner
0 siblings, 1 reply; 2+ messages in thread
From: Tapasweni Pathak @ 2015-03-04 12:49 UTC (permalink / raw)
To: vinholikatti, JBottomley, linux-scsi, linux-kernel
Cc: tapaswenipathak, julia.lawall
Check for null before being dereferenced to avoid a invalid null
dereference.
Found using Coccinelle.
Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
drivers/scsi/ufs/ufshcd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5d60a86..c54e64f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4268,12 +4268,15 @@ static int ufshcd_config_vreg(struct device *dev,
struct ufs_vreg *vreg, bool on)
{
int ret = 0;
- struct regulator *reg = vreg->reg;
- const char *name = vreg->name;
+ struct regulator *reg;
+ const char *name;
int min_uV, uA_load;
BUG_ON(!vreg);
+ reg = vreg->reg;
+ name = vreg->name;
+
if (regulator_count_voltages(reg) > 0) {
min_uV = on ? vreg->min_uV : 0;
ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: scsi: ufs: Fix possible null derefrence
2015-03-04 12:49 [PATCH] drivers: scsi: ufs: Fix possible null derefrence Tapasweni Pathak
@ 2015-03-10 10:28 ` Gilad Broner
0 siblings, 0 replies; 2+ messages in thread
From: Gilad Broner @ 2015-03-10 10:28 UTC (permalink / raw)
To: Tapasweni Pathak
Cc: vinholikatti, jbottomley, linux-scsi, linux-kernel,
tapaswenipathak, julia.lawall
> Check for null before being dereferenced to avoid a invalid null
> dereference.
>
> Found using Coccinelle.
>
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> drivers/scsi/ufs/ufshcd.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 5d60a86..c54e64f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4268,12 +4268,15 @@ static int ufshcd_config_vreg(struct device *dev,
> struct ufs_vreg *vreg, bool on)
> {
> int ret = 0;
> - struct regulator *reg = vreg->reg;
> - const char *name = vreg->name;
> + struct regulator *reg;
> + const char *name;
> int min_uV, uA_load;
>
> BUG_ON(!vreg);
Please add to the patch fix for another instance of this in
ufshcd_config_vreg_load():
static int ufshcd_config_vreg_load(struct device *dev,
struct ufs_vreg *vreg, int ua)
{
int ret = 0;
struct regulator *reg = vreg->reg;
const char *name = vreg->name;
BUG_ON(!vreg);
Gilad.
--
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-10 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 12:49 [PATCH] drivers: scsi: ufs: Fix possible null derefrence Tapasweni Pathak
2015-03-10 10:28 ` Gilad Broner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).