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 4F4C3C678D5 for ; Tue, 7 Mar 2023 23:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbjCGXbI (ORCPT ); Tue, 7 Mar 2023 18:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjCGXbD (ORCPT ); Tue, 7 Mar 2023 18:31:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E236A8E8C for ; Tue, 7 Mar 2023 15:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678231807; 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=J6PI1+iCyE6roSMv9xD9czxTetp5xB/wELaV59zECsA=; b=UeqgWKznONFz3xjSZ5pOv1pxSYLnUK39MAPTNWsi4Z4GmB65ys1rndX1/pd8LJVE8MBVkj 5B3PuLBZ/dpvfO/TZjz1ymgWVhLrqJzf0mBr1yB8ToGGWmyyFhrH4DOISWAm0Z/L0Y9vu0 siLtUifLVgo7luvCZemQ+mWQ7n9sfZM= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-lU7-W_GIO5O9uOFB5pdLAQ-1; Tue, 07 Mar 2023 18:30:06 -0500 X-MC-Unique: lU7-W_GIO5O9uOFB5pdLAQ-1 Received: by mail-ed1-f70.google.com with SMTP id da22-20020a056402177600b004c60694083eso20955230edb.5 for ; Tue, 07 Mar 2023 15:30:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678231804; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J6PI1+iCyE6roSMv9xD9czxTetp5xB/wELaV59zECsA=; b=eESDxybU4yN8EpI8XKR+SGonFfBrALWyNeG6HIZV4AezKAv8RTpBXJTSb/aWyuLRTB MNZBUi68y4oaxBimYdsfylGOEq4fMIslp72IB2+OtOQSErQ5nj6k8gDWvtrbHuIa9khm sf1Fia9Cvp5ZZXYFqaz6t5LpiLsTEdb1epbvdGYTHkOBmsLAKfLQ0OZU6WvERfmO4WgI aKpW+mM3VO3ZfOU/+zmDf3cyGGzIECYr/MhvNsCLnxgVCZ9dXWsnl1LqMY2f4M5R6fgY f4psw6Nr0hiv2pxZ01tgGY4/6BEXQmd5Lc7ukQirnaRD6pcP3HMVutH4pjlJmpk/7gEV qBSQ== X-Gm-Message-State: AO0yUKWuh9aaRpn1xT13OQj66pWJbImYL9ZNBPHbR0zXqga933OuxDNt jhw6l0MlORPbTxts9+jY6g3jMJt0+0U/GCegrWNWDksWmp3DSiJSq2NT/6GkNSFmpkGKl8BLYu5 LRwf9mUVbuX60RVAbVkTUtYuNOjmcKS0p3oPMyqJgaTPBqaYzpgQ= X-Received: by 2002:a17:906:338e:b0:895:58be:963 with SMTP id v14-20020a170906338e00b0089558be0963mr8232070eja.3.1678231804500; Tue, 07 Mar 2023 15:30:04 -0800 (PST) X-Google-Smtp-Source: AK7set9coWPUtSLheaorma3dgyMbSg7MoTxqNt3KtKyykwtN6bNRkYrNVGPELngFdSk7U65m5Hc5Z4Cg9GtbJewyOo8= X-Received: by 2002:a17:906:338e:b0:895:58be:963 with SMTP id v14-20020a170906338e00b0089558be0963mr8232062eja.3.1678231804260; Tue, 07 Mar 2023 15:30:04 -0800 (PST) MIME-Version: 1.0 References: <20230306191824.4115839-1-harshit.m.mogalapalli@oracle.com> In-Reply-To: From: Alexander Aring Date: Tue, 7 Mar 2023 18:29:52 -0500 Message-ID: Subject: Re: [PATCH next] ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx() To: Simon Horman Cc: Harshit Mogalapalli , Dan Carpenter , Alexander Aring , Stefan Schmidt , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Mar 7, 2023 at 3:44=E2=80=AFAM 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 =3D 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 negat= ive > > integers, this is found by static analysis with smatch. > > > > Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device drive= r") > > 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 > sure, thanks for catching this. - Alex