mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: posix_cpu_timer: initialize "now" variable
Date: Thu, 4 Apr 2013 13:45:41 +0000	[thread overview]
Message-ID: <201304041345.41971.arnd@arndb.de> (raw)

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

             reply	other threads:[~2013-04-04 13:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 13:45 Arnd Bergmann [this message]
2013-04-04 13:50 ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201304041345.41971.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®