Skip to content

Commit

Permalink
thunderbolt: Right shifting to zero bug in tbnet_handle_packet()
Browse files Browse the repository at this point in the history
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: e69b6c0 ("net: Add support for networking over Thunderbolt cable")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Oct 19, 2017
1 parent 9a03c3d commit fa31f0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/thunderbolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static int tbnet_handle_packet(const void *buf, size_t size, void *data)
struct tbnet *net = data;
u32 command_id;
int ret = 0;
u8 sequence;
u32 sequence;
u64 route;

/* Make sure the packet is for us */
Expand Down

0 comments on commit fa31f0c

Please sign in to comment.