Commit 7e041abf authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarDavid Sterba <dsterba@suse.cz>
Reviewed-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f0fd1b73
...@@ -378,9 +378,9 @@ static void swap_packet_bitfield_to_le(unsigned char *data) ...@@ -378,9 +378,9 @@ static void swap_packet_bitfield_to_le(unsigned char *data)
/* /*
* transform bits from aa.bbb.ccc to ccc.bbb.aa * transform bits from aa.bbb.ccc to ccc.bbb.aa
*/ */
ret |= tmp & 0xc0 >> 6; ret |= (tmp & 0xc0) >> 6;
ret |= tmp & 0x38 >> 1; ret |= (tmp & 0x38) >> 1;
ret |= tmp & 0x07 << 5; ret |= (tmp & 0x07) << 5;
*data = ret & 0xff; *data = ret & 0xff;
#endif #endif
} }
...@@ -393,9 +393,9 @@ static void swap_packet_bitfield_from_le(unsigned char *data) ...@@ -393,9 +393,9 @@ static void swap_packet_bitfield_from_le(unsigned char *data)
/* /*
* transform bits from ccc.bbb.aa to aa.bbb.ccc * transform bits from ccc.bbb.aa to aa.bbb.ccc
*/ */
ret |= tmp & 0xe0 >> 5; ret |= (tmp & 0xe0) >> 5;
ret |= tmp & 0x1c << 1; ret |= (tmp & 0x1c) << 1;
ret |= tmp & 0x03 << 6; ret |= (tmp & 0x03) << 6;
*data = ret & 0xff; *data = ret & 0xff;
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment