From: Colin King > Sent: 25 October 2018 15:32 > > From: Colin Ian King <colin.king@xxxxxxxxxxxxx> > > In the expression "utx_len << 28", utx_len starts as u8, but is promoted > to a signed int, then sign-extended to u64. If utx_len is 0xf8 or greater > then the sign extension will set all the upper bits of utx_cmd which is > probably not what was intended. Cast to utx_len to u64 to avoid the sign > extension. RTFC... utx_len is only ever 1, 2 or 3. The 'problem' would arise if utx_len << 28 set the high bit. This can only happen if utx_len is more than 7 (NFI where 0xf8 came from). In any case the best fix is to use 'unsigned int' for wr_len and utx_len. There is no point making local variable (or functions parameters/results) smaller that 'int' unless you explicitly want the arithmetic to wrap. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)