* [patch] intel_ips: potential null dereference
@ 2010-08-07 22:01 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-08-07 22:01 UTC (permalink / raw)
To: Matthew Garrett
Cc: Jesse Barnes, Jiri Slaby, platform-driver-x86, kernel-janitors
There is a potential NULL dereference of "limits." We can just return
NULL earlier to avoid it. The caller already handles NULL returns.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index afe82e5..c908048 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1342,8 +1342,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
limits = &ips_lv_limits;
else if (strstr(boot_cpu_data.x86_model_id, "CPU U"))
limits = &ips_ulv_limits;
- else
+ else {
dev_info(&ips->dev->dev, "No CPUID match found.\n");
+ goto out;
+ }
rdmsrl(TURBO_POWER_CURRENT_LIMIT, turbo_power);
tdp = turbo_power & TURBO_TDP_MASK;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch] intel_ips: potential null dereference
@ 2010-08-07 22:01 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-08-07 22:01 UTC (permalink / raw)
To: Matthew Garrett
Cc: Jesse Barnes, Jiri Slaby, platform-driver-x86, kernel-janitors
There is a potential NULL dereference of "limits." We can just return
NULL earlier to avoid it. The caller already handles NULL returns.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index afe82e5..c908048 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1342,8 +1342,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
limits = &ips_lv_limits;
else if (strstr(boot_cpu_data.x86_model_id, "CPU U"))
limits = &ips_ulv_limits;
- else
+ else {
dev_info(&ips->dev->dev, "No CPUID match found.\n");
+ goto out;
+ }
rdmsrl(TURBO_POWER_CURRENT_LIMIT, turbo_power);
tdp = turbo_power & TURBO_TDP_MASK;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] intel_ips: potential null dereference
2010-08-07 22:01 ` Dan Carpenter
@ 2010-08-07 23:48 ` Jesse Barnes
-1 siblings, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2010-08-07 23:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Matthew Garrett, Jiri Slaby, platform-driver-x86, kernel-janitors
On Sun, 8 Aug 2010 00:01:12 +0200
Dan Carpenter <error27@gmail.com> wrote:
> There is a potential NULL dereference of "limits." We can just return
> NULL earlier to avoid it. The caller already handles NULL returns.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> index afe82e5..c908048 100644
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -1342,8 +1342,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
> limits = &ips_lv_limits;
> else if (strstr(boot_cpu_data.x86_model_id, "CPU U"))
> limits = &ips_ulv_limits;
> - else
> + else {
> dev_info(&ips->dev->dev, "No CPUID match found.\n");
> + goto out;
> + }
>
> rdmsrl(TURBO_POWER_CURRENT_LIMIT, turbo_power);
> tdp = turbo_power & TURBO_TDP_MASK;
Yep, good idea to catch this case.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] intel_ips: potential null dereference
@ 2010-08-07 23:48 ` Jesse Barnes
0 siblings, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2010-08-07 23:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Matthew Garrett, Jiri Slaby, platform-driver-x86, kernel-janitors
On Sun, 8 Aug 2010 00:01:12 +0200
Dan Carpenter <error27@gmail.com> wrote:
> There is a potential NULL dereference of "limits." We can just return
> NULL earlier to avoid it. The caller already handles NULL returns.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> index afe82e5..c908048 100644
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -1342,8 +1342,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
> limits = &ips_lv_limits;
> else if (strstr(boot_cpu_data.x86_model_id, "CPU U"))
> limits = &ips_ulv_limits;
> - else
> + else {
> dev_info(&ips->dev->dev, "No CPUID match found.\n");
> + goto out;
> + }
>
> rdmsrl(TURBO_POWER_CURRENT_LIMIT, turbo_power);
> tdp = turbo_power & TURBO_TDP_MASK;
Yep, good idea to catch this case.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-07 23:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-07 22:01 [patch] intel_ips: potential null dereference Dan Carpenter
2010-08-07 22:01 ` Dan Carpenter
2010-08-07 23:48 ` Jesse Barnes
2010-08-07 23:48 ` Jesse Barnes
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.