summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>2023-03-06 11:18:24 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-05 11:23:46 +0200
commitac63f78d9aca3cd10802b2d9e6c12a3f03b262c7 (patch)
treeff8871417b6c3cb9b3c7d0a31bd4ad440c891eb7
parent8b1269b709c9d3314cb2c6283474c4e5340621b7 (diff)
downloadlinux-ac63f78d9aca3cd10802b2d9e6c12a3f03b262c7.tar.gz
linux-ac63f78d9aca3cd10802b2d9e6c12a3f03b262c7.tar.bz2
linux-ac63f78d9aca3cd10802b2d9e6c12a3f03b262c7.zip
ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx()
[ Upstream commit 748b2f5e82d17480404b3e2895388fc2925f7caf ] mac_len is of type unsigned, which can never be less than zero. mac_len = ieee802154_hdr_peek_addrs(skb, &header); if (mac_len < 0) return mac_len; Change this to type int as ieee802154_hdr_peek_addrs() can return negative integers, this is found by static analysis with smatch. Fixes: 6c993779ea1d ("ca8210: fix mac_len negative array access") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Acked-by: Alexander Aring <aahringo@redhat.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20230306191824.4115839-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ieee802154/ca8210.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 5beb447529f9..1c5d70c60354 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -1945,10 +1945,9 @@ static int ca8210_skb_tx(
struct ca8210_priv *priv
)
{
- int status;
struct ieee802154_hdr header = { };
struct secspec secspec;
- unsigned int mac_len;
+ int mac_len, status;
dev_dbg(&priv->spi->dev, "%s called\n", __func__);