From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id C04BDA0679 for ; Wed, 3 Apr 2019 16:45:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 74D481B466; Wed, 3 Apr 2019 16:45:24 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 9F0BA1B465 for ; Wed, 3 Apr 2019 16:45:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 07:45:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,304,1549958400"; d="scan'208";a="312832726" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga005.jf.intel.com with ESMTP; 03 Apr 2019 07:45:21 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Wed, 3 Apr 2019 15:45:02 +0100 Message-Id: <20190403144505.46234-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190403144505.46234-1-bruce.richardson@intel.com> References: <20190403144505.46234-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/5] devtools/cocci: make strlcpy replacement smarter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190403144502.j7smOohbFER5py7q5LFDC3EMig4fU6qDVaVv8T_ccSo@z> The original coccinelle script worked by replacing instances of snprintf(.."%s",...) with strlcpy(), but only where the source and dest parameters were plain identifiers. Allowing expressions for those params opens up a wide range of other possible changes. Signed-off-by: Bruce Richardson --- devtools/cocci/strlcpy.cocci | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/devtools/cocci/strlcpy.cocci b/devtools/cocci/strlcpy.cocci index 335e27128..6f6beb697 100644 --- a/devtools/cocci/strlcpy.cocci +++ b/devtools/cocci/strlcpy.cocci @@ -1,6 +1,5 @@ @use_strlcpy@ -identifier src, dst; -expression size; +expression src, dst, size; @@ ( - snprintf(dst, size, "%s", src) -- 2.20.1