From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=oX1YHHz64X01rWaYta9PxOZA+Y+SF6YtCioIoccBc88=; b=fYOeXyNSnMVKirKQoKM07WPB4ThZ/5GPksyMhF4yeOEFMSxYZqOQQhPwbvWcnKPtB8EP 4UE+afi5lMHHQ5DJcROl4TWbZ/UlPr5uGUprul5zFVmYEekttyO6rLlekuYSCqlijgi6 rkoqdKyDcwBwIBIy2dK+pdxF0EaIpvaeBXHaHOThHPMXQDsO7dqWv5RuKLcHWkNU+apa 92IjMUlzeuh8AuF8cX0R9pT2jElekB63p2NyMhyq+uSUKbaLf93amA3Q3dM72/ryDQYq gamUTFZcY2febbxzbUjcD8jN9ZCljZ9YwCwGUZzhl4wB0zLf68mOykmx3w7BHrschznX 5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oX1YHHz64X01rWaYta9PxOZA+Y+SF6YtCioIoccBc88=; b=pdxM2Pg8k1PXxwNU8QW1zycqIT+gMB37hiZQuSHL+01nNZe0qz4b5agU+11/4ZhTblWlexg2dqywSwueExwnvsx+SE3In0izgT6RT2HNY8xs9HSAoMfzsfZJj4vPL7xoAKYF2HOpZEEnwDs9qnvl63neYW74AQLBER49Px3taQw= Date: Thu, 31 Mar 2022 11:14:10 +0300 From: Dan Carpenter Subject: Re: [PATCH v2 2/2] Documentation: dev-tools: Enhance static analysis section with discussion Message-ID: <20220331081409.GY12805@kadam> References: <11f4750c6d4c175994dfd36d1ff385f68f61bd02.1648593132.git.marcelo.schmitt1@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: MIME-Version: 1.0 To: David Gow 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 List-ID: 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. regards, dan carpenter