Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1218808pxb; Fri, 1 Apr 2022 07:41:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdAYcPgY42kQ0AfOzJw5BgfgGp7WO/5SLraRArMuijf/9qzL+z+24zCtfRd1iWl2ufKrcU X-Received: by 2002:a63:ff63:0:b0:386:327:5353 with SMTP id s35-20020a63ff63000000b0038603275353mr15074250pgk.401.1648824087805; Fri, 01 Apr 2022 07:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648824087; cv=none; d=google.com; s=arc-20160816; b=OuNaMhAh00R60B02M0jiBRUzc53t0vmy3ggFUKnurFCWz2Z6y4zRrO5bRI/Yx+c4P5 df1rxUlW2+tDGGYqRfIdiAr8qDkhVHaw5cUZZRB+D+B/FhWZlguiHe1HAdTPyV2wGQXa cEbFlFJCYuHI70XM9Z52ByScwWwPaYtqRAKaxIrrco65To17BluhiHrLK+IA6zqEE7KO nu+ccfrXBpRu/ww0P5kqu4oo78wcWjcr4Prtc33vPb8UQuUSqn7HEQSWK1Zu8czYsBY6 EAfE6Tt8uFwsT59NMPcOZYqJeHVmgUf1n3samDhYENncg2HpJUbJMpmnTuUCcKi1aWZD eZvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PlnMpYOXkJb3MsWMx3t3Karvr7oM4CxvFXYgLvSP2H0=; b=woAid594CROfPTE1yB+O/Oo0/sw5jTFr7Yjtlx5CKCAj28qa8fIbO0ge1eNdIo919v /JD8AfYDTuZatikUh+U+v6nL6Ps2uy2IwY9HOMowevp/wA0JNjn9qlB88q+6fTGqPd++ Nx1vXTgIRsPdZVVX4+AYiEaS7zEKSDNX2U41XLkLV1etZxm3crRPM8Ityx5nc/u50pmx 1mwAZEZy5I6I4xZlvYbmWgdlyS/zdSi+6oNJ5+WAqmoYUeo8Sdz+QjZ2j7chwLPYTFlK Pxlky7IfzQ0PEOSZP1dWSXJV/r46IkPPiFeASYnWVeSseb2YG8S69POH/GsnYxxSO2Wo pfTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=kbN4drDW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a170903121000b0015651a49b5asi2487812plh.464.2022.04.01.07.41.13; Fri, 01 Apr 2022 07:41:27 -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=@google.com header.s=20210112 header.b=kbN4drDW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243400AbiDAAVd (ORCPT + 99 others); Thu, 31 Mar 2022 20:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243422AbiDAAV1 (ORCPT ); Thu, 31 Mar 2022 20:21:27 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5073BBE1 for ; Thu, 31 Mar 2022 17:19:26 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id r9-20020a1c4409000000b0038ccb70e239so1704799wma.3 for ; Thu, 31 Mar 2022 17:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PlnMpYOXkJb3MsWMx3t3Karvr7oM4CxvFXYgLvSP2H0=; b=kbN4drDWXGTqRpuC4U+JxL0qNBRMGx952a73rWLXDa3Hlm4aUdgJ31IqJEf0Jx+ckC 1aJEH9r0xzziPwQvQ5yR1zUgu8b/A3UaeJj9uHP6ugBk9il8p0uWsatZhH3m63SU1PVb LN+cROaanx5Hz6L2eD/KARZEowFji8nqD3SDTP8xKSDNd/A+2m2aG1X7n3oXXmbJXACF hWT+lCd9PhmgX7/cm4cn2k1BfRaTONAJdglMtzT2LRzqKs1SgYRqmfcpiohHool4PHfC eBuxx0iSCjIKVM+oUt93JFB24big5m2lNXVTPtPBTXmCA350ONdXl0t25CsLDpnjccyz jRDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PlnMpYOXkJb3MsWMx3t3Karvr7oM4CxvFXYgLvSP2H0=; b=AqEpM0t2K4FAq4/8Fy4O34nZBVlcUPQbaHNJJDG9O5BA5XB3/ZMRu7VRWbCv5BFivU b0GyV78ssjDfoLBsQuRsEjQurh3MqMrwNhqVv3NFUqNrJlFriOT6Rvhyb9GurmlcPoVd w2suC3h3JgKSnC4IY5+KebPfPBypE4LyA1aMvOt33t4nRei2dzusp8hrZ7TcFQi6DDpK cZWx4o2hBpIv9CSaEeZxVynXd8xA/CWL6pHM2Hgf7MdpOYPsZU/sYMmVUw4YZ1JGMvhI EYnDhQhF29IgFhnsDN7EJoPaxILmPCKkJorBujmbWpymC8g3Q2lDpV/nplZCzubMDizn y91g== X-Gm-Message-State: AOAM5321I7hEjMAEsIw+0JU0T7MOniq3nkihSSys9GmrAcbmQXiZE9ML iP4QRGlV/zLbTAYW/bkAvui0Vgzhpp7LGlIukyp16g== X-Received: by 2002:a05:600c:40f:b0:38c:be5c:9037 with SMTP id q15-20020a05600c040f00b0038cbe5c9037mr6618416wmb.44.1648772365332; Thu, 31 Mar 2022 17:19:25 -0700 (PDT) MIME-Version: 1.0 References: <11f4750c6d4c175994dfd36d1ff385f68f61bd02.1648593132.git.marcelo.schmitt1@gmail.com> <20220331081409.GY12805@kadam> In-Reply-To: <20220331081409.GY12805@kadam> From: David Gow Date: Fri, 1 Apr 2022 08:19:13 +0800 Message-ID: Subject: Re: [PATCH v2 2/2] Documentation: dev-tools: Enhance static analysis section with discussion To: Dan Carpenter Cc: Marcelo Schmitt , Jonathan Corbet , Mauro Carvalho Chehab , Daniel Latypov , "open list:DOCUMENTATION" , linux-sparse@vger.kernel.org, cocci@inria.fr, smatch@vger.kernel.org, Linux Kernel Mailing List , Shuah Khan , julia.lawall@inria.fr Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Thu, Mar 31, 2022 at 4:14 PM Dan Carpenter wrote: > > On Wed, Mar 30, 2022 at 10:48:13AM +0800, David Gow wrote: > > > + > > > +Smatch does flow analysis and, if allowed to build the function database, it > > > +also does cross function analysis. Smatch tries to answer questions like where > > > +is this buffer allocated? How big is it? Can this index be controlled by the > > > +user? Is this variable larger than that variable? > > > + > > > +It's generally easier to write checks in Smatch than it is to write checks in > > > +Sparse. Nevertheless, there are some overlaps between Sparse and Smatch checks > > > +because there is no reason for re-implementing Sparse's check in Smatch. > > > > This last sentence isn't totally clear to me. Should this "because" be "so"? > > > > I stopped reading your email when you wrote "Cheers, David" but I should > have scrolled down. > > There is not very much overlap between Sparse and Smatch. Both have a > warning for if (!x & y). That is a tiny thing. The big overlap is when > it comes to the locking checks. The Smatch check for locking is > honestly way better and more capable. > > I always run both Sparse and Smatch on my patches. I should run > Coccinelle as well, but I'm more familiar with Sparse and Smatch. Makes sense. I agree that the overlap doesn't seem particularly important: it's the differences which should be more evident. v3[1] of the patch cuts this down to just "Nevertheless, there are some overlaps between Sparse and Smatch checks.", which I think is an improvement. Thanks, -- David [1]: https://lore.kernel.org/all/62f461a20600b95e694016c4e5348ef2e260fa87.1648674305.git.marcelo.schmitt1@gmail.com/