* [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()
@ 2008-09-29 18:23 Hiroshi Shimamoto
2008-09-30 8:58 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-29 18:23 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
compiler warnings;
CC kernel/sched.o
kernel/sched.c: In function 'task_delta_exec':
kernel/sched.c:4055: warning: unused variable 'flags'
kernel/sched.c:4054: warning: 'rq' is used uninitialized in this function
calling task_delta_exec() may cause unexpected pointer access.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
kernel/sched.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 30b73fc..b6c0dd8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4055,6 +4055,7 @@ unsigned long long task_delta_exec(struct task_struct *p)
unsigned long flags;
u64 ns = 0;
+ rq = task_rq_lock(p, &flags);
if (task_current(rq, p)) {
u64 delta_exec;
@@ -4063,6 +4064,7 @@ unsigned long long task_delta_exec(struct task_struct *p)
if ((s64)delta_exec > 0)
ns = delta_exec;
}
+ task_rq_unlock(rq, &flags);
return ns;
}
--
1.5.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()
2008-09-29 18:23 [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec() Hiroshi Shimamoto
@ 2008-09-30 8:58 ` Ingo Molnar
2008-09-30 16:45 ` Hiroshi Shimamoto
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2008-09-30 8:58 UTC (permalink / raw)
To: Hiroshi Shimamoto; +Cc: linux-kernel, Frank Mayhar
* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> compiler warnings;
>
> CC kernel/sched.o
> kernel/sched.c: In function 'task_delta_exec':
> kernel/sched.c:4055: warning: unused variable 'flags'
> kernel/sched.c:4054: warning: 'rq' is used uninitialized in this function
>
> calling task_delta_exec() may cause unexpected pointer access.
heh, just fixed that as well, latest tip/master should have the fix.
Have you seen any weirdness due to this uninitialized variable?
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()
2008-09-30 8:58 ` Ingo Molnar
@ 2008-09-30 16:45 ` Hiroshi Shimamoto
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Shimamoto @ 2008-09-30 16:45 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, Frank Mayhar
Ingo Molnar wrote:
> * Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
>
>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>
>> compiler warnings;
>>
>> CC kernel/sched.o
>> kernel/sched.c: In function 'task_delta_exec':
>> kernel/sched.c:4055: warning: unused variable 'flags'
>> kernel/sched.c:4054: warning: 'rq' is used uninitialized in this function
>>
>> calling task_delta_exec() may cause unexpected pointer access.
>
> heh, just fixed that as well, latest tip/master should have the fix.
>
> Have you seen any weirdness due to this uninitialized variable?
No I've never seen any problem yesterday.
And I didn't have much time to use tip tree yesterday:)
Today's looks good.
thanks,
Hiroshi Shimamoto
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-30 16:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-29 18:23 [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec() Hiroshi Shimamoto
2008-09-30 8:58 ` Ingo Molnar
2008-09-30 16:45 ` Hiroshi Shimamoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox