Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp143422rwb; Wed, 14 Dec 2022 15:12:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7VxMso8+6PuloRDUAKHurDSr/SuiwMV7AFz3qPzohpJ76zJ5g59IdQf0QPB1H3sU4M1J9K X-Received: by 2002:a17:906:1d01:b0:7c1:36:9002 with SMTP id n1-20020a1709061d0100b007c100369002mr21564406ejh.67.1671059529835; Wed, 14 Dec 2022 15:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671059529; cv=none; d=google.com; s=arc-20160816; b=kdn0OJU/TPJZ2MpY2fXZA1Fy8awdY9htFoNHgzYHhYuZAaoce4vnRK0lEIlPEZ+G/O PaxZmKx2zVqM8AVGm+5/moN3r0O3eWfPVpuKRLvpTM/+FUlyjtfxL3q8PvQbHKp/JJ7Y KmOXIxiz5guERjYMKKfLdXiwq4TryZz1lrjw3c0D5x1wLbI/qM+aEeIsv+AS/mMvQ7SZ /sUEikkXlaPJd+Vnl9TVwtiXQKv6JOv3eDMtVjU/RwqBz3BlxsxtOQWhi6ijlRX0glDE 1LO8ZOqZoZ3AiVtnpSEl5GtW0Ok3KcLC5RGvXuanE891cYwEP5yny8DiJnz4ndN0HOVY Y/pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hy0ZrfBvFtETt+PRltvb4QtmJSThXlmtPXJEJGSfMKQ=; b=ekFhmX++QcLoegFdKKOuLNC/3Q08hYO7/weUFPT8RbXeoHk+L9SPoMG8s3RSxHDJXV vNjRKXt117Neer3bn+0oua65dwfNQrvr8vCyybtJE7e3N3XMIzd3wySspINZ5YEv/O06 wljsRZbqlH2AALxrI7vlEykZGnnXqn984769zio60GuX83jAiZEFE/7hIJuocRn5u3tq kq4C2vqmuBtEvw1sB6oXCuX/EkG1NWXgZ1v8mc2ai0sxq4pIoOGYVwJzVNjW761zN6FE +CGfEF5OVot78OJkCRJKlHPm1dpu2WA/6PCJ1Z1F2YueS3zgdL64j++ZT+9mqTiNSQ1k wrrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ljKxj2xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb15-20020a170907960f00b0078db1258ae9si12694783ejc.555.2022.12.14.15.11.53; Wed, 14 Dec 2022 15:12:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ljKxj2xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbiLNWqb (ORCPT + 69 others); Wed, 14 Dec 2022 17:46:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiLNWq0 (ORCPT ); Wed, 14 Dec 2022 17:46:26 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1766A36D41; Wed, 14 Dec 2022 14:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671057974; x=1702593974; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=blKr85VDRrsCdVGyZu/nawGaU6nyURJeIMV9D/SQEk8=; b=ljKxj2xMXxxXZtrVxPPbL0rMNYoSiZEYiMDG/BgkmAadpo1AGnls5e8K aB3enc97N/DssvMlyljqFM1IZgDr//EEdoTGZQB6v/R2aeEDbahNHzLkq hvWsU3z2xuOhMtl/+kmE52jR9U5h/OSplMsNu9mhoQhyFuAzIRsYsnWBB RSfuH8QRFdCHrnkWiY1YHDlfUQJ4eNduH/mlz7S1bckLQNh4qRTzgBm8A tBpuCEryzOZvyjv+gRT+EU/ZqbO3vxqFjQ3Vwg9lRqFH2Wal8iAGt++FT aare7Dy4izmSXuQu/n+EJchzM4QIQUQpdt/VcNDPsH7Ew83GKp3bagHFN Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="318577454" X-IronPort-AV: E=Sophos;i="5.96,245,1665471600"; d="scan'208";a="318577454" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2022 14:45:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="712646318" X-IronPort-AV: E=Sophos;i="5.96,245,1665471600"; d="scan'208";a="712646318" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga008.fm.intel.com with ESMTP; 14 Dec 2022 14:45:48 -0800 Date: Wed, 14 Dec 2022 14:54:02 -0800 From: Ricardo Neri To: "Luck, Tony" Cc: "yang.yang29@zte.com.cn" , "bp@alien8.de" , "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "xu.panda@zte.com.cn" Subject: Re: [PATCH linux-next] x86/mce/dev-mcelog: use strscpy() to instead of strncpy() Message-ID: <20221214225402.GA16409@ranerica-svr.sc.intel.com> References: <202212031419324523731@zte.com.cn> <20221214205438.GB15255@ranerica-svr.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 14, 2022 at 09:29:59PM +0000, Luck, Tony wrote: > >> The implementation of strscpy() is more robust and safer. > >> That's now the recommended way to copy NUL terminated strings. > > > > It should read "NULL-terminated strings". > > Both "NUL-terminated" and "NULL-terminated" seem to be used in the kernel > source and commit comments. NULL is ahead 124:45 in the source, but it > is closer in the commit logs where the ratio is 129:76. > > Single "L" NUL seems technically more accurate as the string terminator is > an ascii NUL character. From man 5 ascii the character name is NUL (though > the description says "null" to muddy the waters) > > Oct Dec Hex Char > ─────────────────────────────────────────── > 000 0 00 NUL '\0' (null character) Thanks for the analysis Tony. Indeed, I agree that "NUL-terminated" is more accurate. Thanks and BR, Ricardo