Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 2F8B87D2F0 for ; Thu, 25 Jul 2019 22:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbfGYW5R (ORCPT ); Thu, 25 Jul 2019 18:57:17 -0400 Received: from smtprelay0049.hostedemail.com ([216.40.44.49]:33929 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726529AbfGYW5R (ORCPT ); Thu, 25 Jul 2019 18:57:17 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id CDF89181D33FC; Thu, 25 Jul 2019 22:57:16 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: linen95_3f6004f62bf19 X-Filterd-Recvd-Size: 1633 Received: from XPS-9350 (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Thu, 25 Jul 2019 22:57:15 +0000 (UTC) Message-ID: Subject: Re: [PATCH v6] Documentation/checkpatch: Prefer stracpy over strcpy/strlcpy/strncpy. From: Joe Perches To: NitinGote , keescook@chromium.org Cc: corbet@lwn.net, akpm@linux-foundation.org, apw@canonical.com, linux-doc@vger.kernel.org, kernel-hardening@lists.openwall.com Date: Thu, 25 Jul 2019 15:57:13 -0700 In-Reply-To: <20190725112219.6244-1-nitin.r.gote@intel.com> References: <20190725112219.6244-1-nitin.r.gote@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Thu, 2019-07-25 at 16:52 +0530, NitinGote wrote: > From: Nitin Gote > > Added check in checkpatch.pl to deprecate strcpy(), strlcpy() and > strncpy() in favor of stracpy(). [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > +our %deprecated_string_apis = ( > + "strcpy" => "stracpy", > + "strlcpy" => "stracpy", > + "strncpy" => "stracpy - for non-NUL-terminated uses, strncpy dest should be __nonstring", > +); Maybe: our %deprecated_string_apis = ( "strcpy" => "stracpy or strscpy", "strlcpy" => "stracpy or strscpy", "strncpy" => "stracpy or strscpy - for non-NUL-terminated uses, strncpy dest should be __nonstring", );