Skip to content
Commit 0132af05 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

soundwire: fix sign extension when shifting buf[2] 24 places



The buf[2] left shift by 24 bits is promoted to int (32 bit signed)
and then signed-extended to unsigned long long. Hence if the upper
bit to buf[2] is set then all the upper bits of addr end up as 1.
Fix this by casting it to u64 before shifting it. Also replace the
unsigned long long casts to u64 casts to match the same type of
addr.

Detected by CoverityScan, CID#1463147 ("Unintended sign extension")

Fixes: d52d7a1b ("soundwire: Add Slave status handling helpers")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24d142d5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment