linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] futex: Hide false positive about uninit var usage
@ 2010-11-16 16:32 Sergio Aguirre
  2010-11-16 16:43 ` Darren Hart
  0 siblings, 1 reply; 4+ messages in thread
From: Sergio Aguirre @ 2010-11-16 16:32 UTC (permalink / raw)
  To: LKML
  Cc: Sergio Aguirre, Thomas Gleixner, Peter Zijlstra, Darren Hart,
	Ingo Molnar, Namhyung Kim

In exit_robust_list, there was this warning shown:

kernel/futex.c: In function 'exit_robust_list':
kernel/futex.c:2492: warning: 'next_pi' may be used uninitialized in this function

Which is a false positive, since in the function, the only scenario
possible in which the var is read, is after a successful excecution of
fetch_robust_entry, which populates the variable.

So there's no real possibility of it being used uninitialized.

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhart@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
---
 kernel/futex.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 6c683b3..3646157 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2489,7 +2489,8 @@ void exit_robust_list(struct task_struct *curr)
 {
 	struct robust_list_head __user *head = curr->robust_list;
 	struct robust_list __user *entry, *next_entry, *pending;
-	unsigned int limit = ROBUST_LIST_LIMIT, pi, next_pi, pip;
+	unsigned int limit = ROBUST_LIST_LIMIT, pi;
+	unsigned int uninitialized_var(next_pi), pip;
 	unsigned long futex_offset;
 	int rc;
 
-- 
1.7.0.4


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

* Re: [RFC][PATCH] futex: Hide false positive about uninit var usage
  2010-11-16 16:32 [RFC][PATCH] futex: Hide false positive about uninit var usage Sergio Aguirre
@ 2010-11-16 16:43 ` Darren Hart
  2010-11-16 16:59   ` Aguirre, Sergio
  0 siblings, 1 reply; 4+ messages in thread
From: Darren Hart @ 2010-11-16 16:43 UTC (permalink / raw)
  To: Sergio Aguirre
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Ingo Molnar, Namhyung Kim

On 11/16/2010 08:32 AM, Sergio Aguirre wrote:
> In exit_robust_list, there was this warning shown:
>
> kernel/futex.c: In function 'exit_robust_list':
> kernel/futex.c:2492: warning: 'next_pi' may be used uninitialized in this function
>
> Which is a false positive, since in the function, the only scenario
> possible in which the var is read, is after a successful excecution of
> fetch_robust_entry, which populates the variable.
>
> So there's no real possibility of it being used uninitialized.

Hi Sergio,

You are correct. Thomas has recently pulled my fix for this into tip, it 
should be queued for mainline already.

Thanks,

Darren Hart

>
> Signed-off-by: Sergio Aguirre<saaguirre@ti.com>
> Cc: Thomas Gleixner<tglx@linutronix.de>
> Cc: Peter Zijlstra<a.p.zijlstra@chello.nl>
> Cc: Darren Hart<dvhart@linux.intel.com>
> Cc: Ingo Molnar<mingo@elte.hu>
> Cc: Namhyung Kim<namhyung@gmail.com>
> ---
>   kernel/futex.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 6c683b3..3646157 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -2489,7 +2489,8 @@ void exit_robust_list(struct task_struct *curr)
>   {
>   	struct robust_list_head __user *head = curr->robust_list;
>   	struct robust_list __user *entry, *next_entry, *pending;
> -	unsigned int limit = ROBUST_LIST_LIMIT, pi, next_pi, pip;
> +	unsigned int limit = ROBUST_LIST_LIMIT, pi;
> +	unsigned int uninitialized_var(next_pi), pip;
>   	unsigned long futex_offset;
>   	int rc;
>


-- 
Darren Hart
Yocto Linux Kernel

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

* RE: [RFC][PATCH] futex: Hide false positive about uninit var usage
  2010-11-16 16:43 ` Darren Hart
@ 2010-11-16 16:59   ` Aguirre, Sergio
  2010-11-16 17:30     ` Darren Hart
  0 siblings, 1 reply; 4+ messages in thread
From: Aguirre, Sergio @ 2010-11-16 16:59 UTC (permalink / raw)
  To: Darren Hart
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Ingo Molnar, Namhyung Kim

Hi Darren,

> -----Original Message-----
> From: Darren Hart [mailto:dvhart@linux.intel.com]
> Sent: Tuesday, November 16, 2010 10:43 AM
> To: Aguirre, Sergio
> Cc: LKML; Thomas Gleixner; Peter Zijlstra; Ingo Molnar; Namhyung Kim
> Subject: Re: [RFC][PATCH] futex: Hide false positive about uninit var
> usage
> 
> On 11/16/2010 08:32 AM, Sergio Aguirre wrote:
> > In exit_robust_list, there was this warning shown:
> >
> > kernel/futex.c: In function 'exit_robust_list':
> > kernel/futex.c:2492: warning: 'next_pi' may be used uninitialized in
> this function
> >
> > Which is a false positive, since in the function, the only scenario
> > possible in which the var is read, is after a successful excecution of
> > fetch_robust_entry, which populates the variable.
> >
> > So there's no real possibility of it being used uninitialized.
> 
> Hi Sergio,
> 
> You are correct. Thomas has recently pulled my fix for this into tip, it
> should be queued for mainline already.

Oh ok. Sorry, I didn't know that. Please ignore this patch then.

Regards,
Sergio

> 
> Thanks,
> 
> Darren Hart
> 
> >
> > Signed-off-by: Sergio Aguirre<saaguirre@ti.com>
> > Cc: Thomas Gleixner<tglx@linutronix.de>
> > Cc: Peter Zijlstra<a.p.zijlstra@chello.nl>
> > Cc: Darren Hart<dvhart@linux.intel.com>
> > Cc: Ingo Molnar<mingo@elte.hu>
> > Cc: Namhyung Kim<namhyung@gmail.com>
> > ---
> >   kernel/futex.c |    3 ++-
> >   1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/kernel/futex.c b/kernel/futex.c
> > index 6c683b3..3646157 100644
> > --- a/kernel/futex.c
> > +++ b/kernel/futex.c
> > @@ -2489,7 +2489,8 @@ void exit_robust_list(struct task_struct *curr)
> >   {
> >   	struct robust_list_head __user *head = curr->robust_list;
> >   	struct robust_list __user *entry, *next_entry, *pending;
> > -	unsigned int limit = ROBUST_LIST_LIMIT, pi, next_pi, pip;
> > +	unsigned int limit = ROBUST_LIST_LIMIT, pi;
> > +	unsigned int uninitialized_var(next_pi), pip;
> >   	unsigned long futex_offset;
> >   	int rc;
> >
> 
> 
> --
> Darren Hart
> Yocto Linux Kernel

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

* Re: [RFC][PATCH] futex: Hide false positive about uninit var usage
  2010-11-16 16:59   ` Aguirre, Sergio
@ 2010-11-16 17:30     ` Darren Hart
  0 siblings, 0 replies; 4+ messages in thread
From: Darren Hart @ 2010-11-16 17:30 UTC (permalink / raw)
  To: Aguirre, Sergio
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Ingo Molnar, Namhyung Kim

On 11/16/2010 08:59 AM, Aguirre, Sergio wrote:
> Hi Darren,
>
>> -----Original Message-----
>> From: Darren Hart [mailto:dvhart@linux.intel.com]
>> Sent: Tuesday, November 16, 2010 10:43 AM
>> To: Aguirre, Sergio
>> Cc: LKML; Thomas Gleixner; Peter Zijlstra; Ingo Molnar; Namhyung Kim
>> Subject: Re: [RFC][PATCH] futex: Hide false positive about uninit var
>> usage
>>
>> On 11/16/2010 08:32 AM, Sergio Aguirre wrote:
>>> In exit_robust_list, there was this warning shown:
>>>
>>> kernel/futex.c: In function 'exit_robust_list':
>>> kernel/futex.c:2492: warning: 'next_pi' may be used uninitialized in
>> this function
>>>
>>> Which is a false positive, since in the function, the only scenario
>>> possible in which the var is read, is after a successful excecution of
>>> fetch_robust_entry, which populates the variable.
>>>
>>> So there's no real possibility of it being used uninitialized.
>>
>> Hi Sergio,
>>
>> You are correct. Thomas has recently pulled my fix for this into tip, it
>> should be queued for mainline already.
>
> Oh ok. Sorry, I didn't know that. Please ignore this patch then.

No problem. In the future, if you run into problems with futexes, check 
the linux-2.6-tip repository for fixes as that is where they are queued 
up before going into mainline.

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
branch: core/futexes

Thanks,

Darren

>
> Regards,
> Sergio
>
>>
>> Thanks,
>>
>> Darren Hart
>>
>>>
>>> Signed-off-by: Sergio Aguirre<saaguirre@ti.com>
>>> Cc: Thomas Gleixner<tglx@linutronix.de>
>>> Cc: Peter Zijlstra<a.p.zijlstra@chello.nl>
>>> Cc: Darren Hart<dvhart@linux.intel.com>
>>> Cc: Ingo Molnar<mingo@elte.hu>
>>> Cc: Namhyung Kim<namhyung@gmail.com>
>>> ---
>>>    kernel/futex.c |    3 ++-
>>>    1 files changed, 2 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/kernel/futex.c b/kernel/futex.c
>>> index 6c683b3..3646157 100644
>>> --- a/kernel/futex.c
>>> +++ b/kernel/futex.c
>>> @@ -2489,7 +2489,8 @@ void exit_robust_list(struct task_struct *curr)
>>>    {
>>>    	struct robust_list_head __user *head = curr->robust_list;
>>>    	struct robust_list __user *entry, *next_entry, *pending;
>>> -	unsigned int limit = ROBUST_LIST_LIMIT, pi, next_pi, pip;
>>> +	unsigned int limit = ROBUST_LIST_LIMIT, pi;
>>> +	unsigned int uninitialized_var(next_pi), pip;
>>>    	unsigned long futex_offset;
>>>    	int rc;
>>>
>>
>>
>> --
>> Darren Hart
>> Yocto Linux Kernel


-- 
Darren Hart
Yocto Linux Kernel

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

end of thread, other threads:[~2010-11-16 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 16:32 [RFC][PATCH] futex: Hide false positive about uninit var usage Sergio Aguirre
2010-11-16 16:43 ` Darren Hart
2010-11-16 16:59   ` Aguirre, Sergio
2010-11-16 17:30     ` Darren Hart

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).