Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2136271rwo; Thu, 3 Aug 2023 05:23:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiyM3tu2Jd81TLPwQV4paHCi52XqVZVp+QvOkDf2JKOCn5BtdnBuKXnYWXGW4XkvhS48eI X-Received: by 2002:a05:6a21:9985:b0:13f:13cb:bc51 with SMTP id ve5-20020a056a21998500b0013f13cbbc51mr3867509pzb.25.1691065389303; Thu, 03 Aug 2023 05:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691065389; cv=none; d=google.com; s=arc-20160816; b=sW9gggcHg/Hpwuqa/5ePHsqkghVbrz6WA4XEtC2Xl8RpRWYhH/HcaUhy9GB3MC7Q/j WWOmu/F8t5EONIBeAROTmgKSVhWzPpMclf6F2VLOyYxCyXdo75wfywTlXok+dqtstqti RVGuYfnN7K7EgPn/G39FoyU9xqiR9PW/FhdIwZQzuG3x6OIDYthSxKMlU6LS4zl6xmDF QP1tnX94hiKjnlIVfMYxbhfWiwCbtlo01u478npSdV64c59A51bQt2onNJKeIGex29iW n/fCiKk/Av8K25AEEd36mt66Whsp7kGx1mR8NrpvPbc1A2pcAaW+p/jksRfTVj/+o/Qx wCGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VuvtjFHgGZRCUW+TNZUXEj9FboRSSdVikwCBlQKozb8=; fh=K1M8QvoWo/wRnNj4WtC9RNjvx5ovEBsF/oc9M1XFL6M=; b=FeVSaDZl2yd5isoi0ufNK+g9h4i5EAqH7dq5TjOFTpuD0Sk50OCSv+2rJ5q0nI7FwU B8SRD+rN19Dbe9EvjvLAhb2hFKnlXwpfouSfI74VW/TfN9tfoTAQsWH8sqnh04yRQz8W IJCun5q2KRsC4lnDvpG/ARS/WwOAVuHBFrVxaL3TJWAq+x3L+Zt0yldOgwrNgIOn13ul zrtwzMmsEcSKyLhRPsXW5sSexV1AQO904n1uPZ1JPZaPT0Wc8io8vzbjRP73NYm/KxOH khs9xGar7IhEkvU721VdmRhWOoZw3NrkNB7uzMEDQebh6d6zPcKGgfWQb400QtuedeCg eSIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=um8DGDDr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw21-20020a056a00451500b0068708093a99si2999225pfb.355.2023.08.03.05.22.56; Thu, 03 Aug 2023 05:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=um8DGDDr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234466AbjHCLz4 (ORCPT + 99 others); Thu, 3 Aug 2023 07:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjHCLzy (ORCPT ); Thu, 3 Aug 2023 07:55:54 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF03273E for ; Thu, 3 Aug 2023 04:55:53 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b9e6cc93d8so13393751fa.0 for ; Thu, 03 Aug 2023 04:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691063751; x=1691668551; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VuvtjFHgGZRCUW+TNZUXEj9FboRSSdVikwCBlQKozb8=; b=um8DGDDrx5jcxCuTnwU8y2C9BiWgz53J9iDsEnoEdXrb0rSzV1cLiTvubypdDEOIAE Yt2RZ6OhGqtwH5OjJNKQR52a/HN3QUtQAZK+O7uuyEmExqjLHd36yQR2X5ZaIkJf+N3T LAhHijUjDZE3OvU3mNygRNESoWgaBx9h9UKUZxTh/KTN3o41kZe/ERuLXn3R0tu3UKKD tp7OPRNqMF1fLQ2sMMnMwnCe9nlZR1VfqAN3LlkQW6hlYQKV9Z7gXtzEuoF5GjI1gowh Yl7zJNDyPi/ZwuSC2nwMTz4EdWT61gt2K99z7imvQyTZuScsiaQCd2BTk2AOFZDp3pKD Pq9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691063751; x=1691668551; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VuvtjFHgGZRCUW+TNZUXEj9FboRSSdVikwCBlQKozb8=; b=f2ol45qYTrMxtTS4iDKsTiNFCvfx61q2eqwf31PdiyT7rn1sEyzXflCiBYwMxCmoYD oX9+Fl6tFQxXYoKS+ESRQnqID/1iN8KYMyf09mVNQPEkP2h1mWAUMYNrMdlQj9gJedLR HcAOULZydj13OjfNZ5pjyt22fTUiDlC984BO7sg1JOgu/ubgTb97kcXpvkImQZvISSOB RarG4Vc7S/gTqC43NGKH+nGXoGz9j0k4CdzJbm6MxKnaJMXSuv4pBdaEmE8BXr70eC8q UMBY0KRk1RNGBA9ZPK9Wq4hGQaipMcY1pl2REdkPbgefgbIbFc/IEXJQCF1eYyRyLB1F EVoA== X-Gm-Message-State: ABy/qLbaTFy19pqBxFjqy+7ujdVF8VcQ4oNtDD3pvE22tviHzUkOMHgJ 0O5DWg8QovYj2L9q1sdTdPP5CQ== X-Received: by 2002:a2e:889a:0:b0:2b9:df53:4c2a with SMTP id k26-20020a2e889a000000b002b9df534c2amr8022168lji.20.1691063751522; Thu, 03 Aug 2023 04:55:51 -0700 (PDT) Received: from localhost (h3221.n1.ips.mtn.co.ug. [41.210.178.33]) by smtp.gmail.com with ESMTPSA id ov38-20020a170906fc2600b009929ab17bdfsm10330191ejb.168.2023.08.03.04.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 04:55:50 -0700 (PDT) Date: Thu, 3 Aug 2023 14:55:46 +0300 From: Dan Carpenter To: Simon Horman Cc: Ratheesh Kannoth , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com, jerinj@marvell.com, hkelam@marvell.com, sbhatta@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us Subject: Re: [PATCH v1 net-next 2/4] tc: flower: support for SPI Message-ID: <664b202a-d126-4708-a2af-94f768fe3abd@kadam.mountain> References: <20230801014101.2955887-1-rkannoth@marvell.com> <20230801014101.2955887-3-rkannoth@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 02, 2023 at 09:07:35PM +0200, Simon Horman wrote: > + Dan Carpenter > > On Tue, Aug 01, 2023 at 07:10:59AM +0530, Ratheesh Kannoth wrote: > > @@ -1894,6 +1915,12 @@ static int fl_set_key(struct net *net, struct nlattr **tb, > > return ret; > > } > > > > + if (tb[TCA_FLOWER_KEY_SPI]) { > > + ret = fl_set_key_spi(tb, key, mask, extack); > > + if (ret) > > + return ret; > > + } > > + > > Hi Dan, > > I'm seeing a warning from Smatch, which I think is a false positive, > but I feel that I should raise. Perhaps you could take a look at it? > > net/sched/cls_flower.c:1918 fl_set_key() error: buffer overflow 'tb' 106 <= 108 > You're using the cross function database, right? What happens is that when someone adds a new type of net link attribute, it takes a rebuild for the database to sync up. I can't think of a good way to fix this. This information is passed as a BUF_SIZE. Each database rebuild passes the BUF_SIZE one call further down the call tree. $ smdb fl_set_key | grep BUF_SIZE net/sched/cls_flower.c | fl_change | fl_set_key | BUF_SIZE | 1 | tb | 864 net/sched/cls_flower.c | fl_tmplt_create | fl_set_key | BUF_SIZE | 1 | tb | 864 This is a flaw in how Smatch works, and theoretically it affects everything, but in practical terms it affect netlink attribute tables the most. Other places are not modified as often or they pass the size as a parameter. I could modify check_index_overflow.c to silence warnings where it's a netlink attribute table and the offset is less than __TCA_FLOWER_MAX. regards, dan carpenter