Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6e2d76a authored by Harshit Mogalapalli's avatar Harshit Mogalapalli Committed by Greg Kroah-Hartman
Browse files

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: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230306191824.4115839-1-harshit.m.mogalapalli@oracle.com


Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 856fb74f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1944,10 +1944,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__);