WSL2-Linux-Kernel/drivers/net/dsa/hirschmann
Colin Ian King 2776d2320a net: dsa: fix unintended sign extension on a u16 left shift
The left shift of u16 variable high is promoted to the type int and
then sign extended to a 64 bit u64 value.  If the top bit of high is
set then the upper 32 bits of the result end up being set by the
sign extension. Fix this by explicitly casting the value in high to
a u64 before left shifting by 16 places.

Also, remove the initialisation of variable value to 0 at the start
of each loop iteration as the value is never read and hence the
assignment it is redundant.

Addresses-Coverity: ("Unintended sign extension")
Fixes: e4b27ebc78 ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Link: https://lore.kernel.org/r/20201109124008.2079873-1-colin.king@canonical.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-10 17:46:20 -08:00
..
Kconfig net: dsa: hellcreek: Add PTP clock support 2020-11-05 14:04:49 -08:00
Makefile net: dsa: hellcreek: Add support for hardware timestamping 2020-11-05 14:04:49 -08:00
hellcreek.c net: dsa: fix unintended sign extension on a u16 left shift 2020-11-10 17:46:20 -08:00
hellcreek.h net: dsa: hellcreek: Add PTP status LEDs 2020-11-05 14:04:50 -08:00
hellcreek_hwtstamp.c net: dsa: hellcreek: Add support for hardware timestamping 2020-11-05 14:04:49 -08:00
hellcreek_hwtstamp.h net: dsa: hellcreek: Add support for hardware timestamping 2020-11-05 14:04:49 -08:00
hellcreek_ptp.c net: dsa: hellcreek: Add PTP status LEDs 2020-11-05 14:04:50 -08:00
hellcreek_ptp.h net: dsa: hellcreek: Add PTP status LEDs 2020-11-05 14:04:50 -08:00