[PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec() - Kernel

This is a discussion on [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec() - Kernel ; From: Hiroshi Shimamoto 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 --- kernel/sched.c | 2 ++ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()

  1. [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()

    From: Hiroshi Shimamoto

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

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()


    * Hiroshi Shimamoto wrote:

    > From: Hiroshi Shimamoto
    >
    > 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
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [PATCH -tip] sched: fix using uninilialzed rq in task_delta_exec()

    Ingo Molnar wrote:
    > * Hiroshi Shimamoto wrote:
    >
    >> From: Hiroshi Shimamoto
    >>
    >> 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
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread