Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6E66C6FD1F for ; Thu, 16 Mar 2023 16:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbjCPQeZ (ORCPT ); Thu, 16 Mar 2023 12:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbjCPQeA (ORCPT ); Thu, 16 Mar 2023 12:34:00 -0400 Received: from proxima.lasnet.de (proxima.lasnet.de [IPv6:2a01:4f8:121:31eb:3::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 183A8E63C9; Thu, 16 Mar 2023 09:33:18 -0700 (PDT) Received: from [192.168.2.51] (p5dd0da05.dip0.t-ipconnect.de [93.208.218.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id DE3E6C027C; Thu, 16 Mar 2023 17:33:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datenfreihafen.org; s=2021; t=1678984396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UrWrpPv+/3slKvIAuehiHkc06CKCMU5Vv1SKl92JOdI=; b=asCQEiNQyYuBa69dpfM8dBU9fdWuoUqoECwB0zPjNUGlO2ZxHUKZgPlvt8hwPiKRrWIbQL nUsH9QYNeWgNlYye7uDnhZRY3xKLI1Zzdtas23f0DLf/NSiTHgOmYnBmmyitCQ2tSX+st/ Hp4yl61tabPffzYMtTPc885E1Zp+aD7kgzvGZ3cfYb1dGIMlrju4hbvwBvg64IEn78JuXX 2knUuGTc0JV3nitxs93VfJ/7RjKah2a38Z8o3QN0+49LK7EZgu0m9zg+s4Xzc+ZFQYcK/W WVLgD43pndNZ+dtuPYah1HLgPdZX+EPOEbMZNQ41kGPDytTLu8KB0QUZmPuOzg== Message-ID: <93bc1f0a-d1ed-e0cf-30ec-a3b59a1ec678@datenfreihafen.org> Date: Thu, 16 Mar 2023 17:33:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH next] ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx() Content-Language: en-US To: Simon Horman , Harshit Mogalapalli Cc: Dan Carpenter , Alexander Aring , Miquel Raynal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marcel Holtmann , Harry Morris , linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230306191824.4115839-1-harshit.m.mogalapalli@oracle.com> From: Stefan Schmidt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Simon. On 07.03.23 09:42, Simon Horman wrote: > On Mon, Mar 06, 2023 at 11:18:24AM -0800, Harshit Mogalapalli wrote: >> 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: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") >> Signed-off-by: Harshit Mogalapalli > > I discussed this briefly with Harshit offline. > > The commit referenced above tag does add the call to > ieee802154_hdr_peek_addrs(), an there is a sign miss match between > the return value and the variable. > > The code to check the mac_len was added more recently, by the following > commit. However the fixes tag is probably fine as-is, because it's fixing > error handling of a call made in that commit. > > 6c993779ea1d ("ca8210: fix mac_len negative array access") > > Reviewed-by: Simon Horman I agree that the commit above is the better Fixes tag as it makes clear it only comes after this change. I amended the commit message accordingly when applying this to wpan. regards Stefan Schmidt