summaryrefslogtreecommitdiffstats
path: root/drivers/tty/ipwireless
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-10-26 22:25:05 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 20:06:33 -0800
commit7e041abf79c1b555b9d117d4a319b505ee601f55 (patch)
tree5e412b550dc16ddaff8cfcf881ca4936988f84e5 /drivers/tty/ipwireless
parentf0fd1b73b0f3589ff90582fbbb5eedc149caefab (diff)
downloadlinux-7e041abf79c1b555b9d117d4a319b505ee601f55.tar.bz2
tty: ipwireless: Fix probable mask then right shift defects
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> Acked-by: David Sterba <dsterba@suse.cz> Reviewed-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/ipwireless')
-rw-r--r--drivers/tty/ipwireless/hardware.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index 2c14842541dd..5c77e1eac4ee 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
}