public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] apic, x86: Need to set offset before using it
@ 2010-10-25  5:46 Jaswinder Singh
  2010-10-25  5:58 ` [PATCH v2] " Jaswinder Singh
  0 siblings, 1 reply; 3+ messages in thread
From: Jaswinder Singh @ 2010-10-25  5:46 UTC (permalink / raw)
  To: Robert Richter, Ingo Molnar, Stephen Rothwell, LKML

 
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/oprofile/op_model_amd.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 42fb46f..c65a924 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -285,6 +285,7 @@ static inline int ibs_eilvt_valid(void)
 	int offset;
 
 	rdmsrl(MSR_AMD64_IBSCTL, val);
+	offset = val & IBSCTL_LVT_OFFSET_MASK;
 	if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
 		pr_err(FW_BUG "cpu %d, invalid IBS "
 		       "interrupt offset %d (MSR%08X=0x%016llx)",
@@ -293,8 +294,6 @@ static inline int ibs_eilvt_valid(void)
 		return 0;
 	}
 
-	offset = val & IBSCTL_LVT_OFFSET_MASK;
-
 	if (eilvt_is_available(offset))
 		return !0;
 
-- 
1.7.2.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] apic, x86: Need to set offset before using it
  2010-10-25  5:46 [PATCH] apic, x86: Need to set offset before using it Jaswinder Singh
@ 2010-10-25  5:58 ` Jaswinder Singh
  2010-10-25  6:50   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Jaswinder Singh @ 2010-10-25  5:58 UTC (permalink / raw)
  To: Robert Richter; +Cc: Ingo Molnar, Stephen Rothwell, LKML


Fix the issue pointed by Stephen.
 
Stephen Rothwell wrote :
In building Linus' tree, today's linux-next build (x86_64 allmodconfig)
produced this warning:

arch/x86/oprofile/op_model_amd.c: In function 'ibs_eilvt_valid':
arch/x86/oprofile/op_model_amd.c:289: warning: 'offset' may be used uninitialized in this function

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/oprofile/op_model_amd.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 42fb46f..c65a924 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -285,6 +285,7 @@ static inline int ibs_eilvt_valid(void)
 	int offset;
 
 	rdmsrl(MSR_AMD64_IBSCTL, val);
+	offset = val & IBSCTL_LVT_OFFSET_MASK;
 	if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
 		pr_err(FW_BUG "cpu %d, invalid IBS "
 		       "interrupt offset %d (MSR%08X=0x%016llx)",
@@ -293,8 +294,6 @@ static inline int ibs_eilvt_valid(void)
 		return 0;
 	}
 
-	offset = val & IBSCTL_LVT_OFFSET_MASK;
-
 	if (eilvt_is_available(offset))
 		return !0;
 
-- 
1.7.2.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] apic, x86: Need to set offset before using it
  2010-10-25  5:58 ` [PATCH v2] " Jaswinder Singh
@ 2010-10-25  6:50   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2010-10-25  6:50 UTC (permalink / raw)
  To: Jaswinder Singh; +Cc: Robert Richter, Stephen Rothwell, LKML


* Jaswinder Singh <jaswinder@infradead.org> wrote:

> Fix the issue pointed by Stephen.
>  
> Stephen Rothwell wrote :
> In building Linus' tree, today's linux-next build (x86_64 allmodconfig)
> produced this warning:
> 
> arch/x86/oprofile/op_model_amd.c: In function 'ibs_eilvt_valid':
> arch/x86/oprofile/op_model_amd.c:289: warning: 'offset' may be used uninitialized in this function
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Robert Richter <robert.richter@amd.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
>  arch/x86/oprofile/op_model_amd.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
> index 42fb46f..c65a924 100644
> --- a/arch/x86/oprofile/op_model_amd.c
> +++ b/arch/x86/oprofile/op_model_amd.c
> @@ -285,6 +285,7 @@ static inline int ibs_eilvt_valid(void)
>  	int offset;
>  
>  	rdmsrl(MSR_AMD64_IBSCTL, val);
> +	offset = val & IBSCTL_LVT_OFFSET_MASK;
>  	if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
>  		pr_err(FW_BUG "cpu %d, invalid IBS "
>  		       "interrupt offset %d (MSR%08X=0x%016llx)",
> @@ -293,8 +294,6 @@ static inline int ibs_eilvt_valid(void)
>  		return 0;
>  	}
>  
> -	offset = val & IBSCTL_LVT_OFFSET_MASK;
> -
>  	if (eilvt_is_available(offset))
>  		return !0;

I queued up a different fix, one which also address some of the structural details 
in this function.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-25  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25  5:46 [PATCH] apic, x86: Need to set offset before using it Jaswinder Singh
2010-10-25  5:58 ` [PATCH v2] " Jaswinder Singh
2010-10-25  6:50   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox