thunderbolt: Fix a couple right shifting to zero bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 17 Oct 2017 12:32:17 +0000 (15:32 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Oct 2017 12:04:32 +0000 (13:04 +0100)
commit9a03c3d398c17eadfc5bc470c1084beb71c088f1
tree2091433de0df2d70996ed29f4063a0ad52f1b61a
parenta90cca7c75907380b3be7110c2e3007b743553b4
thunderbolt: Fix a couple right shifting to zero bugs

The problematic code looks like this:

res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK;
res_seq >>= TB_XDOMAIN_SN_SHIFT;

TB_XDOMAIN_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: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/thunderbolt/xdomain.c