usb: isp1760: do not shift in uninitialized slot
authorRui Miguel Silva <rui.silva@linaro.org>
Thu, 19 Aug 2021 18:09:28 +0000 (19:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Aug 2021 11:30:39 +0000 (13:30 +0200)
commit7d1d3882fd9da1ee42fe3ad3a5ffd41fb8204380
tree27eca31813a36cd5ff0e9ea1c1297fec7d284311
parent5e4cd1b6556302fe6a457e525c256cbef3563543
usb: isp1760: do not shift in uninitialized slot

Even though it is not expected, and would trigger a WARN_ON, killing a
transfer in a uninitialized slot this sequence is warned by clang
analyzer, twice:

drivers/usb/isp1760/isp1760-hcd.c:1976:18: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                skip_map |= (1 << qh->slot);
drivers/usb/isp1760/isp1760-hcd.c:1983:18: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                skip_map |= (1 << qh->slot);

Only set skip map if slot is active.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20210819180929.1327349-5-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/isp1760/isp1760-hcd.c