lkml.org 
[lkml]   [2014]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 09/11] tty: ipwireless: Fix probable mask then right shift defects
    On Sun, 26 Oct 2014, Joe Perches wrote:

    > Precedence of & and >> is not the same and is not left to right.
    > shift has higher precedence and should be done after the mask.
    >
    > Add parentheses around the masks.
    >
    > Signed-off-by: Joe Perches <joe@perches.com>

    Reviewed-by: Jiri Kosina <jkosina@suse.cz>

    Greg, can you take this through your char/misc tree, please?

    Thanks.

    > ---
    > drivers/tty/ipwireless/hardware.c | 12 ++++++------
    > 1 file changed, 6 insertions(+), 6 deletions(-)
    >
    > diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
    > index 2c14842..5c77e1e 100644
    > --- a/drivers/tty/ipwireless/hardware.c
    > +++ b/drivers/tty/ipwireless/hardware.c
    > @@ -378,9 +378,9 @@ static void swap_packet_bitfield_to_le(unsigned char *data)
    > /*
    > * transform bits from aa.bbb.ccc to ccc.bbb.aa
    > */
    > - ret |= tmp & 0xc0 >> 6;
    > - ret |= tmp & 0x38 >> 1;
    > - ret |= tmp & 0x07 << 5;
    > + ret |= (tmp & 0xc0) >> 6;
    > + ret |= (tmp & 0x38) >> 1;
    > + ret |= (tmp & 0x07) << 5;
    > *data = ret & 0xff;
    > #endif
    > }
    > @@ -393,9 +393,9 @@ static void swap_packet_bitfield_from_le(unsigned char *data)
    > /*
    > * transform bits from ccc.bbb.aa to aa.bbb.ccc
    > */
    > - ret |= tmp & 0xe0 >> 5;
    > - ret |= tmp & 0x1c << 1;
    > - ret |= tmp & 0x03 << 6;
    > + ret |= (tmp & 0xe0) >> 5;
    > + ret |= (tmp & 0x1c) << 1;
    > + ret |= (tmp & 0x03) << 6;
    > *data = ret & 0xff;
    > #endif
    > }
    > --
    > 2.1.2
    >

    --
    Jiri Kosina
    SUSE Labs


    \
     
     \ /
      Last update: 2014-10-27 15:41    [W:8.407 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site