Re: [PATCH 1/2 v2 net-next] thunderbolt: Fix a couple right shifting to zero bugs

2017-10-19 Thread David Miller
From: Dan Carpenter Date: Tue, 17 Oct 2017 15:32:17 +0300 > 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 resu

[PATCH 1/2 v2 net-next] thunderbolt: Fix a couple right shifting to zero bugs

2017-10-17 Thread Dan Carpenter
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: d1f