Commit fa31f0c9 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

thunderbolt: Right shifting to zero bug in tbnet_handle_packet()

There is a problem when we do:

	sequence = pkg->hdr.length_sn & TBIP_HDR_SN_MASK;
	sequence >>= TBIP_HDR_SN_SHIFT;

TBIP_HDR_SN_SHIFT is 27, and right shifting a u8 27 bits is always
going to result in zero.  The fix is to declare these variables as u32.

Fixes: e69b6c02 ("net: Add support for networking over Thunderbolt cable")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarYehezkel Bernat <yehezkel.bernat@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a03c3d3
...@@ -394,7 +394,7 @@ static int tbnet_handle_packet(const void *buf, size_t size, void *data) ...@@ -394,7 +394,7 @@ static int tbnet_handle_packet(const void *buf, size_t size, void *data)
struct tbnet *net = data; struct tbnet *net = data;
u32 command_id; u32 command_id;
int ret = 0; int ret = 0;
u8 sequence; u32 sequence;
u64 route; u64 route;
/* Make sure the packet is for us */ /* Make sure the packet is for us */
......
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