lkml.org 
[lkml]   [2008]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 2/5] ftrace: use code patching for ftrace graph tracer
    From
    Date
    On Wed, 2008-11-26 at 10:02 -0800, Andrew Morton wrote:
    > > >
    > > > > + return -EINVAL;
    > > > > +
    > > > > + *(int *)(&code[1]) = new_offset;
    > > >
    > > > Might be able to use put_unaligned_foo() here.
    > > >
    > > > The problem is that these functions use sizeof(*ptr) to work out what
    > > > to do, so a cast is still needed. A get_unaligned32(ptr) would be
    > > > nice. One which takes a void* and assumes CPU ordering.
    > >
    > > Is there a correctness concern here? This is arch specific code, so I'm
    > > not worried about other archs.
    >
    > No, the code is OK as-is.
    >
    > It's just that "read a word from an [maybe-]unaligned address" is such
    > a common operation that there should be a nice clean simple function to
    > do it, rather than doing open-coded (and different) weird C tricks at each
    > and\ every site.
    >

    Also it is arch-specific, so if you know unaligned access is OK, just doing the
    cast+deref is OK.

    Harvey



    \
     
     \ /
      Last update: 2008-11-26 19:09    [W:4.200 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site