Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7941555ybi; Tue, 9 Jul 2019 06:41:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFl5h8WG5aLiMD4WbQF6vCi3fpbTQYOPwQUoKxnT8vZd/GSjWQg103OE98IzBhw49l1LLH X-Received: by 2002:a65:6448:: with SMTP id s8mr31012468pgv.223.1562679707105; Tue, 09 Jul 2019 06:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562679707; cv=none; d=google.com; s=arc-20160816; b=HZjU4JifVw+Gg9MDlLUI3HZ2HwOPIYhoG+KYtaXDQRLUKrn1gZ8WyEstxwRnLtIA6W /N4ZVJQNoiDDLRejTcr7SY5R/N/xhrzUrkytCQGgq4KWZS020lgC3gH+oe3sKjcVmgIR +atfk+t6/qvC+wmKY1tp5Am2C/LBimBPDY7m48kqNqOMICjcXQSpNGr9IWEx6HuJQohS GlLot+nVxPU9FwC+bVkxyTVca3ngwJMnhS6GuhAELfLran2I0tR7TOugqeYcuprXWtnY kfPIQPmvdHV1yxIFagTGqnrkZPtqsC/fb3UuJGSKS0eQj91tQWYKuX11ejMfWtwYubRr 6l3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=z9e9McbneRn0pewDnx9tdQ1ylWt+BaGX3xy5l/qRRpU=; b=W7oQk4R7RS8tzDAsTcP6lE4NH9fGRqc3Wbcm3EEmC31c+gTOw3EhUTGkBCLHBnODXJ W6QutwtxcflxC3pa8uZ2jEvrUcIng0IwyyemRV+Dr4lpIEuvZOnursRxvExlEiViYrf/ lsT1nkto6I6+9EoLvmksz/XaF0MD1/9fwhJuiW3wryaok+Ul2hFkeWoLbd/QdwTMotuO Fk5D5LLBKm6JUR34t2h1sTBIf60hzoBGSJ3lAf+/lCtQG8dQbsMpgBdOMHi4mdR0T5OM L/2wBcY1ZnLB+G7x8jQukAuerYLXHEzkpx1FAhhcr1sVFQXtJPfQaqse/OX35AuNIrg5 ivyA== 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 v197si22448471pgb.29.2019.07.09.06.41.31; Tue, 09 Jul 2019 06:41:47 -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 S1726920AbfGINkw (ORCPT + 99 others); Tue, 9 Jul 2019 09:40:52 -0400 Received: from ms.lwn.net ([45.79.88.28]:58352 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfGINkw (ORCPT ); Tue, 9 Jul 2019 09:40:52 -0400 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id A67C2737; Tue, 9 Jul 2019 13:40:51 +0000 (UTC) Date: Tue, 9 Jul 2019 07:40:50 -0600 From: Jonathan Corbet To: NitinGote Cc: joe@perches.com, akpm@linux-foundation.org, apw@canonical.com, keescook@chromium.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] Added warnings in checkpatch.pl script to : Message-ID: <20190709074050.289aab82@lwn.net> In-Reply-To: <20190709122417.25778-1-nitin.r.gote@intel.com> References: <20190709122417.25778-1-nitin.r.gote@intel.com> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Jul 2019 17:54:17 +0530 NitinGote wrote: > From: Nitin Gote The patch needs a proper subject line. > 1. Deprecate strcpy() in favor of strscpy(). > 2. Deprecate strlcpy() in favor of strscpy(). > 3. Deprecate strncpy() in favor of strscpy() or strscpy_pad(). > > Updated strncpy() section in Documentation/process/deprecated.rst > to cover strscpy_pad() case. > > Signed-off-by: Nitin Gote > --- > Change log: > v1->v2 > - For string related apis, created different %deprecated_string_api > and these will get emitted at CHECK Level using command line option > -f/--file to avoid bad patched from novice script users. > > v2->v3 > - Avoided use of $check in implementation. > - Incorporated trivial comments. > > Documentation/process/deprecated.rst | 6 +++--- > scripts/checkpatch.pl | 24 ++++++++++++++++++++++++ > 2 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst > index 49e0f64a3427..f564de3caf76 100644 > --- a/Documentation/process/deprecated.rst > +++ b/Documentation/process/deprecated.rst > @@ -93,9 +93,9 @@ will be NUL terminated. This can lead to various linear read overflows > and other misbehavior due to the missing termination. It also NUL-pads the > destination buffer if the source contents are shorter than the destination > buffer size, which may be a needless performance penalty for callers using > -only NUL-terminated strings. The safe replacement is :c:func:`strscpy`. > -(Users of :c:func:`strscpy` still needing NUL-padding will need an > -explicit :c:func:`memset` added.) > +only NUL-terminated strings. In this case, the safe replacement is > +:c:func:`strscpy`. If, however, the destination buffer still needs > +NUL-padding, the safe replacement is :c:func:`strscpy_pad`. Please don't use :c:func: in anything new; just write that as strscpy() (or whatever) and The Right Thing will happen. (Maybe we need a checkpatch rule for that :) Thanks, jon