Skip to content

Commit

Permalink
ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx()
Browse files Browse the repository at this point in the history
commit 748b2f5 upstream.

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: 6c99377 ("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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Harshit Mogalapalli authored and Greg Kroah-Hartman committed Apr 5, 2023
1 parent c4b1e70 commit a15fce1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -1944,10 +1944,9 @@ static int ca8210_skb_tx(
struct ca8210_priv *priv
)
{
int status;
struct ieee802154_hdr header = { 0 };
struct secspec secspec;
unsigned int mac_len;
int mac_len, status;

dev_dbg(&priv->spi->dev, "ca8210_skb_tx() called\n");

Expand Down

0 comments on commit a15fce1

Please sign in to comment.