From: Colin Ian King Date: Wed, 13 Sep 2017 17:02:02 +0000 (+0100) Subject: staging: iio: ade7759: fix signed extension bug on shift of a u8 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d10c7e4c08f6ce862142655aac31ff301860f68f;p=pandora-kernel.git staging: iio: ade7759: fix signed extension bug on shift of a u8 commit 13ffe9a26df4e156363579b25c904dd0b1e31bfb upstream. The current shift of st->rx[2] left shifts a u8 24 bits left, promotes the integer to a an int and then to a unsigned u64. If the top bit of st->rx[2] is set then we end up with all the upper bits being set to 1. Fix this by casting st->rx[2] to a u64 before the 24 bit left shift. Detected by CoverityScan CID#144940 ("Unintended sign extension") Fixes: 2919fa54ef64 ("staging: iio: meter: new driver for ADE7759 devices") Signed-off-by: Colin Ian King Signed-off-by: Jonathan Cameron Signed-off-by: Ben Hutchings --- Reading git-diff-tree failed