Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbdGRIsC (ORCPT ); Tue, 18 Jul 2017 04:48:02 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:41264 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbdGRIsA (ORCPT ); Tue, 18 Jul 2017 04:48:00 -0400 X-IronPort-AV: E=Sophos;i="5.40,377,1496095200"; d="scan'208";a="283829648" Date: Tue, 18 Jul 2017 10:47:59 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Elena Reshetova cc: linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr, Gilles Muller , nicolas.palix@imag.fr, mmarek@suse.com, keescook@chromium.org, ishkamiel@gmail.com Subject: Re: [PATCH] Coccinelle report script for refcounters In-Reply-To: <1500364111-2192-1-git-send-email-elena.reshetova@intel.com> Message-ID: References: <1500364111-2192-1-git-send-email-elena.reshetova@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1243 Lines: 40 On Tue, 18 Jul 2017, Elena Reshetova wrote: > The below script can be used to detect potential misusage > of atomic_t type and API for reference counting purposes. > Now when we have a dedicated refcount_t type and API with > security protection implemented, people should be using it > instead. > > Currently it still reports many occurences since we are > nowhere near the end of our kernel-wide conversion execrise, > but hopefully after couple of cycles more, the amount of > output would be much more limited. > > Each script result must be analysed manually before any > conversion, since refcount_t might not suit for certain > purposes (for example if an object is not always destroyed > upon refcounter reaching zero, if increments from zero are > allowed in the code etc.) > > As we go further and get less results in output, we will > improve the pattern to detect conversion cases more precisely. The regexps are the best you can do? julia > > Elena Reshetova (1): > Coccinelle: add atomic_as_refcounter script > > scripts/coccinelle/api/atomic_as_refcounter.cocci | 102 ++++++++++++++++++++++ > 1 file changed, 102 insertions(+) > create mode 100644 scripts/coccinelle/api/atomic_as_refcounter.cocci > > -- > 2.7.4 > >