Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3716251pxt; Tue, 10 Aug 2021 09:41:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpmczYuQ85gLJDxU/TPEIBxAAtYWYkLHNz7fJ/Sg6APrA9eGZwz/D6bV7/zcZXuDbYaFCU X-Received: by 2002:aa7:d54b:: with SMTP id u11mr5876398edr.160.1628613675065; Tue, 10 Aug 2021 09:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628613675; cv=none; d=google.com; s=arc-20160816; b=ZR6piGCylmNhF70a20NNqp1wqJLPfnpe6Vz9etnav+q0VtOElMOkVB4GnBOju4Odut W9msUf7yRLM0GIrKtoOeLGis+VswP2YsEsqfG0LhGIZehgJTiCj+QEi/veCOrxIziEfg FqWLxGnaP7qTGS3+TUL3DFMZQVPTN/gZwrdtRER77qv2sIAtdtNswalBq7Qeqi1FfudL APdlJLYEjW/nLtrAOIsP9sRoXnVLXuNqkIR0a/QzighnlXQrpkOp0H14ja8Ra/cuBZ8w enaKAchDLuijj7DrCF3VLLvDluZLZW77dbRSaLo5EY9MnYLBxxalvk9nCSatTcbY1SVQ rGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=qgkiRyBEdPE8kBgrsTzR20TyM5FhTtU+5Idf+Xz9mD0=; b=F0vOEEvM2zFb6ExPEglGY+XG6uVcsPR+x+HaE1+hz5wlUWg+7HAAGWxeXVGGD5zw6U 9/FNr3otHL7nSI2aIZa4/KK1Bm2sIZFONm1pvv5efto+miE5L3Tk+a7HHoIyKiqwoX7o Rz8l5EYg5sQtE7hnkKEn67FGR/JneR7W7GW78FCXhkF7TVq3h13/tVm5Tc+XSswsBNrt GCgbT8Pnp6+YsIooDqkWrWRX8Mat3btqcDKg0kwY7U/HSqEvBNk+wmVU1paLA4k8dmR/ 1C30j0NuR5B/awyuhS6h/QXbbNf/CUixKfkLHVmxm6KKtvZLIGibfV3qpCSz/o0gA1Zl YFvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si17772208edh.357.2021.08.10.09.40.50; Tue, 10 Aug 2021 09:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242473AbhHJPCn (ORCPT + 99 others); Tue, 10 Aug 2021 11:02:43 -0400 Received: from smtprelay0209.hostedemail.com ([216.40.44.209]:57676 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234153AbhHJPCn (ORCPT ); Tue, 10 Aug 2021 11:02:43 -0400 Received: from omf04.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 42AD51836942D; Tue, 10 Aug 2021 15:02:20 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA id A6904D1516; Tue, 10 Aug 2021 15:02:18 +0000 (UTC) Message-ID: Subject: Re: [PATCH v3] drivers/edac/edac_mc: Remove all strcpy() uses From: Joe Perches To: Robert Richter Cc: Len Baker , Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Kees Cook , linux-hardening@vger.kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 10 Aug 2021 08:02:17 -0700 In-Reply-To: References: <20210807155957.10069-1-len.baker@gmx.com> <20210808112617.GA1927@titan> <99448ef29830fda9b19409bc23b0e7513b22f7b7.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.10 X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: A6904D1516 X-Stat-Signature: zomo8gkouz7irgaf7tbabch1cxordum7 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+Gpl2phGQ76xLkFse458J6cytt06otvuo= X-HE-Tag: 1628607738-261957 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-08-10 at 16:36 +0200, Robert Richter wrote: > On 09.08.21 10:18:58, Joe Perches wrote: > > > strscpy and scnprintf have different return values and it's simpler > > and much more common to use scnprintf for appended strings that are > > limited to a specific buffer length. > > Calculating the bytes written from the return value is a oneliner. Not really. You still have to test for strscpy's possible return of -E2BIG.