Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2557356pxt; Mon, 9 Aug 2021 03:32:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu1yjf6ysHSAmniWLq8d0N8L9K+UqjvLGQjJT6oFpBVuu+IuDnspbXuFl67CyCqz8a+r0g X-Received: by 2002:a17:906:f15:: with SMTP id z21mr22231950eji.177.1628505136183; Mon, 09 Aug 2021 03:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628505136; cv=none; d=google.com; s=arc-20160816; b=jEtxmmLIagbEeP5hJcHAvlbNcojhxZLfyFZMI7LWvLbcpPmo6w7Khu4hcJIqMkfKn5 W2t8fwM85WdSSBU3Z3QE2AwJg1b4xw0EuO7xpiNZUbazEZm3uXEqGo+mfwuf4EhKgVEw Pnh1CNl5Eah8Sm0oW1XxG52vuJaGbe5uylerZCUix3rVJK6OujyPd/wjw143FrJRBnGe ot+4lRtVZz82krFkPt6hu5wThnMh0CcgX4j+tVWM7iUM6BKjLsQhUEYNsHtt/BLqpgYf DEyaP42AaASJv+U934Al0Ji/cbbjlbv2Lgfkit5RTn2Y+0N7jB7MfztLLl61iRqTcxMg MYQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PdBzTOaHQ9fpeZ7BFuSZ8K0yiMB1Q2FzGgY8Ota7B3Y=; b=eZfd9jnrE5MS6eBlv7QguNSIR7+0oMxtQW6RstxBv4uwU0IOYGrpx8B1m+vhtB9uVv 9lp3ROj2jU8qjKf8XC3xLHf3IAb7meAs473cbZ3ihKfvbxpUhrOFLAX+YyCk7mE8Xe+f 0ZFCt+WTVC2n1pKpQ6TZukzHp1gwUdbfmjfj6tQVT/yzfkr8TEKTM+qIBnyK3EdfMxIS 6RJ38RQNvxq1YxbFE2ljJVZ0fXPv3TAdziyNbYyBpxlfJ5SK3r9B5GvZnLHc5p5fnGFJ 7vhLOD81AjClL1giYbEDlwJG1SqHERdmz+0/qXt+le2CLlsiigqZ6zEZcu888hfHtk9c /I9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tkLPUzp3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si16720861edc.369.2021.08.09.03.31.53; Mon, 09 Aug 2021 03:32:16 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tkLPUzp3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234831AbhHIKFd (ORCPT + 99 others); Mon, 9 Aug 2021 06:05:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234822AbhHIKF3 (ORCPT ); Mon, 9 Aug 2021 06:05:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAF4861004; Mon, 9 Aug 2021 10:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628503509; bh=2zKz1qElSq58PZRYESvVVX02YG+iPBjCI2bz6gw0UN8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tkLPUzp3FVZI0suGivgvscOU4H5YH5WZAOm7D/zYqm8djWcyc4CaPbrBs5EQiHzi6 Svp6jbyK7pZaVKk5NSlSX/mgyVfAKzvDN5SnlF6Pza1YVkgGZLpWHPKRcLF00uEuWR FyvkpnJWfTghbe/BfclSMxIcqKantX3oTZakzcsa1ZPxg8/2FPwIoSZVNkKde4CHqR zo4Kd3fIrtdmi6dIkCvh1Zwinfv2H+dOb7rm4w9qHQJvMVVQjgmSwPEpb+G4m1Gd55 lS3Gfso+iprAft7mx7Ywk1WJ77XTsMQmV6Jlg1f6yoGULS0odQBO9hDrorA4JHhxrb 20UyaqFPA+Kig== Date: Mon, 9 Aug 2021 12:05:04 +0200 From: Robert Richter To: Len Baker Cc: Joe Perches , 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 Subject: Re: [PATCH v3] drivers/edac/edac_mc: Remove all strcpy() uses Message-ID: References: <20210807155957.10069-1-len.baker@gmx.com> <20210808112617.GA1927@titan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210808112617.GA1927@titan> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.08.21 13:26:17, Len Baker wrote: > > Perhaps this should use scnprintf rather than strscpy > > Something like: > > n += scnprintf(buf + n, len - n, "%s", > > p == e->label ? dim->label : OTHER_LABEL); > > > In the first version [1] the scnprintf was used but Robert Richter don't > see any benefit compared with the current implementation. > > [1] https://lore.kernel.org/linux-hardening/20210725162954.9861-1-len.baker@gmx.com/ Reason is that there is the assumption that p must always point at the end of the string and its trailing zero byte. I am not opposed using the string function's return code instead of strlen() to get the length. But why using formated output if strscpy() can be used? -Robert