lkml.org 
[lkml]   [2015]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 53/57] perf/rapl: Fix crash in rapl_scale()
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Stephane Eranian <eranian@google.com>

    commit 98b008dff8452653909d9263efda925873e8d8bb upstream.

    This patch fixes a systematic crash in rapl_scale()
    due to an invalid pointer.

    The bug was introduced by commit:

    89cbc76768c2 ("x86: Replace __get_cpu_var uses")

    The fix is simple. Just put the parenthesis where it needs
    to be, i.e., around rapl_pmu. To my surprise, the compiler
    was not complaining about passing an integer instead of a
    pointer.

    Reported-by: Vince Weaver <vincent.weaver@maine.edu>
    Tested-by: Vince Weaver <vincent.weaver@maine.edu>
    Fixes: 89cbc76768c2 ("x86: Replace __get_cpu_var uses")
    Signed-off-by: Stephane Eranian <eranian@google.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: cl@linux.com
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: http://lkml.kernel.org/r/20150122203834.GA10228@thinkpad
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/x86/kernel/cpu/perf_event_intel_rapl.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
    +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
    @@ -135,7 +135,7 @@ static inline u64 rapl_scale(u64 v)
    * or use ldexp(count, -32).
    * Watts = Joules/Time delta
    */
    - return v << (32 - __this_cpu_read(rapl_pmu->hw_unit));
    + return v << (32 - __this_cpu_read(rapl_pmu)->hw_unit);
    }

    static u64 rapl_event_update(struct perf_event *event)



    \
     
     \ /
      Last update: 2015-02-04 01:21    [W:4.416 / U:1.532 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site