All of lore.kernel.org
 help / color / mirror / Atom feed
* posix_cpu_timer: initialize "now" variable
@ 2013-04-04 13:45 Arnd Bergmann
  2013-04-04 13:50 ` Frederic Weisbecker
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2013-04-04 13:45 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Andrew Morton, linux-kernel, Thomas Gleixner

Patch 6d0e025 "posix_cpu_timer: consolidate expiry time type" in linux-next
introduces a new compiler warning:

kernel/posix-cpu-timers.c: In function 'posix_cpu_timer_schedule':
kernel/posix-cpu-timers.c:1127:19: warning: 'now' may be used uninitialized in this function [-Wmaybe-uninitialized]
    clear_dead_task(timer, now);

As far as I can tell, that warning is about an actual bug an not
a false positive, as that variable is clearly never initialized
when it gets used in line 1127.

Here is a patch that makes the warning go away for me, no idea if this is
the right solution or not.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index e5286b5..1828b9f 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1119,6 +1119,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
 			timer->it.cpu.expires = 0;
 			goto out_unlock;
 		} else if (unlikely(p->exit_state) && thread_group_empty(p)) {
+			cpu_clock_sample(timer->it_clock, p, &now);
 			/*
 			 * We've noticed that the thread is dead, but
 			 * not yet reaped.  Take this opportunity to

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

* Re: posix_cpu_timer: initialize "now" variable
  2013-04-04 13:45 posix_cpu_timer: initialize "now" variable Arnd Bergmann
@ 2013-04-04 13:50 ` Frederic Weisbecker
  0 siblings, 0 replies; 2+ messages in thread
From: Frederic Weisbecker @ 2013-04-04 13:50 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew Morton, LKML, Thomas Gleixner

2013/4/4 Arnd Bergmann <arnd@arndb.de>:
> Patch 6d0e025 "posix_cpu_timer: consolidate expiry time type" in linux-next
> introduces a new compiler warning:
>
> kernel/posix-cpu-timers.c: In function 'posix_cpu_timer_schedule':
> kernel/posix-cpu-timers.c:1127:19: warning: 'now' may be used uninitialized in this function [-Wmaybe-uninitialized]
>     clear_dead_task(timer, now);
>
> As far as I can tell, that warning is about an actual bug an not
> a false positive, as that variable is clearly never initialized
> when it gets used in line 1127.
>
> Here is a patch that makes the warning go away for me, no idea if this is
> the right solution or not.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I posted a fix two days ago: https://lkml.org/lkml/2013/3/30/63

Thanks.

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

end of thread, other threads:[~2013-04-04 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 13:45 posix_cpu_timer: initialize "now" variable Arnd Bergmann
2013-04-04 13:50 ` Frederic Weisbecker

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.