Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9081943ybi; Tue, 23 Jul 2019 21:28:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqydkb4XG2Nk5APpumfIMnU+YWowM8PoYg+3eSNKod/ivlNTiYwmtoK5/hKNEWuZRKVPeJnx X-Received: by 2002:a17:902:7043:: with SMTP id h3mr55789649plt.10.1563942531055; Tue, 23 Jul 2019 21:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563942531; cv=none; d=google.com; s=arc-20160816; b=tBUL0HbLYkRXqJjb2Stxdubect70nuUM1LE3kPmloWgltCqzrXeISelZSCVl1lyzbl SwcWMfVwztncVhrxoN0KTVUdf0Z25NE4L3lAMigEvRAqn+kaFoz0gUFhTVjpvGZrFj3k wzhaSRbF3JsEN6MxXk98FZ4Iqx+oqK/GPMIHOq8ABgENG9UXMmLGF4m2rTtBFkbAIr8S DuAz5qCmQ8rzUmiYovZWTp1TBpUNv7q2g6xoVvLf6myIOOjLdmRIvs5map22ZSPDliYf JPSPi/10DGrYcUlxSLDW1ZEe30WRwSXYOL84UypboIIoa2qHdLkwUUM6G8OV1XnLGxhb Veyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=8O4b14KlhJil3QIDtKoDNBmChAm01MHs34S1NGdakDo=; b=IFgeajpBzHsiZ4Ca/ETOuHWbbcaSJR4gtO1rP+yf4jwgHplS50qh4REQ+ViwBBHbRB +lsvsvmI27K+kEHySO2xi5tNuQ/UEMP+J7hmp0KGSLn5WzxYrC7zf2C5eKUG+6Qx6vja 6/EKvz1r19iubtoKoTy+NL9wmggajbr9BcPmtIy9ZI7WhDX715pFn+taxWRvQMA3FD/S y4Wz7a55eRxHLKBxGlMoFtOoAOtVvo++UJamyObNcuqyss3Fx91nZ8EtYdfYdMmdA6Os npW2OGdvYOZ+n02fpqgCcflAnE5rAyv2hyc8DLeJmRZWfKy78Zga5DglNP1LTs569MVL VhwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x131si16095975pfd.116.2019.07.23.21.28.36; Tue, 23 Jul 2019 21:28:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbfGXE1X (ORCPT + 99 others); Wed, 24 Jul 2019 00:27:23 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:43076 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfGXE1V (ORCPT ); Wed, 24 Jul 2019 00:27:21 -0400 X-IronPort-AV: E=Sophos;i="5.64,300,1559512800"; d="scan'208";a="314532027" Received: from c-73-22-29-55.hsd1.il.comcast.net (HELO hadrien) ([73.22.29.55]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 06:27:19 +0200 Date: Tue, 23 Jul 2019 23:27:17 -0500 (CDT) From: Julia Lawall X-X-Sender: jll@hadrien To: Joe Perches cc: cocci , LKML Subject: Re: [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] In-Reply-To: Message-ID: References: <7ab8957eaf9b0931a59eff6e2bd8c5169f2f6c41.1563841972.git.joe@perches.com> <66fcdbf607d7d0bea41edb39e5579d63b62b7d84.camel@perches.com> <0f3ba090dfc956f5651e6c7c430abdba94ddcb8b.camel@perches.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Jul 2019, Joe Perches wrote: > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote: > > A seantic patch and the resulting output for the case where the third > > arugument is a constant is attached. Likewise the resulting output on a > > recent linux-next. > > > > julia > > Nice. Thanks Julia > > A couple issues: > > There is a problem with conversions with assignments > of strlcpy() so ideally the cocci script should make sure > any return value was not used before conversion. > > This is not a provably good conversion: > > drivers/s390/char/sclp_ftp.c > @@ -114,8 +114,7 @@ static int sclp_ftp_et7(const struct hmc > sccb->evbuf.mdd.ftp.length = ftp->len; > sccb->evbuf.mdd.ftp.bufaddr = virt_to_phys(ftp->buf); > > - len = strlcpy(sccb->evbuf.mdd.ftp.fident, ftp->fname, > - HMCDRV_FTP_FIDENT_MAX); > + len = stracpy(sccb->evbuf.mdd.ftp.fident, ftp->fname); Sorry, I don't understand the issue here. What specifically should I be looking for? > > And: > > I would have expected the bit below to find and convert uses like > drivers/hwmon/adc128d818.c: strlcpy(info->type, "adc128d818", I2C_NAME_SIZE); > but it seems none of those were converted. OK, thanks. I will check on it. julia > I don't know why. > > //------------------------------------------ > @r1@ > struct i1 *e1; > expression e2; > identifier f,i1,i2; > position p; > @@ > \(strscpy\|strlcpy\)(e1->f, e2, i2)@p > > @@ > identifier r1.i1,r1.i2; > type T; > @@ > struct i1 { ... T i1[i2]; ... } > > @@ > identifier f,i2; > expression e1,e2; > position r1.p; > @@ > ( > -strscpy > +stracpy > | > -strlcpy > +stracpy > )(e1->f, e2 > - , i2 > )@p > //------------------------------------------ > > to find > >