Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp307880pxy; Sat, 31 Jul 2021 07:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoC5N6oquhgRzJwB5Dndzb1JQlex27/PR5PmTG70Z64ADn8bS6X9XfsalFa0ze3L5vtQvH X-Received: by 2002:a05:6402:54d:: with SMTP id i13mr9401048edx.179.1627743492434; Sat, 31 Jul 2021 07:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627743492; cv=none; d=google.com; s=arc-20160816; b=F7xyXDoSsSXtm3EOoS9qpYCAqq0gemiFTEjo9DjzPCU+KfWrX36s4x6b98tNPHnFNp MKiDMr61w7VGn8vVsQZdl7ZgWbi7zbS8+Zcqb9ieVJdPz/zcWhdfJABKoP2JkOR/JGYC 7Kpse0kpy9R4oDlLLCtR+qFcMseXbSvSN/hAa3bFTJgzDf2Un+KhozE75ard6z4XZ9YL 73eBf2EB3IGedogRO0IiV4W/ujjzf8T40CVnmX9NsixXxS7mQmBo1rfR6BLmySnEZZSU 0IVvV0OZCh5X0sDfePuBfQynULh4UGf91szHNNJ3h2D4nFzdqz2cU5ETCWZCS3z4dWSx ztwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uX/Vg3xsd9pIPtkh6DBmWLGHZdfYs/XPyaJd2bZOor0=; b=gv4faWPvfGXrwDhyw83kpHpR+tSb0ono5HrL/y04nMSMOPtHcMHpmGyLhdp8N/kIp/ yIDeNTwGkMU2pSvlwvey/zzWnyNUi/vq9A4kX8L/du1fC4laJEaqXlsUqyxerELFvqXo jmNJj+XjqjlkK2L7/fHUQndBBpldiZ8v0OLs55XRWAd9UoVZghBLF6rKdbKSSF6OvQ+f /MepsgKuNy37+F73Z/nXlGV2JmYiIsiE+58Y0FtFxPkjhGD+iis/K2YgF/kXKNYS55bn xenxXaXbd4HkL+zX/CCOWBtYmA2re87ZP8dFdZpu485hxMkW9VW+7237j3tEHDvnq/d5 YhnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Ganr3Z8M; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si6231547ejc.453.2021.07.31.07.57.46; Sat, 31 Jul 2021 07:58:12 -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=@gmx.net header.s=badeba3b8450 header.b=Ganr3Z8M; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233271AbhGaOy1 (ORCPT + 99 others); Sat, 31 Jul 2021 10:54:27 -0400 Received: from mout.gmx.net ([212.227.15.19]:33831 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233228AbhGaOyZ (ORCPT ); Sat, 31 Jul 2021 10:54:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1627743243; bh=zY96gBywycZ3DkNeGCbLFMqyecwq4irLjId53UZ4Zf8=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=Ganr3Z8MpqDXwLQU1ajZQdu1jXzt1nzmNe7rSSrq26cKszyGo5a8Ip/m0nQHQA9I4 7zOz9eeAaB9UA6ET3eZRakKZAb71Jpo35ILPw6dAfYS5+YQsnpDe2tkyxweGpT3Wkt EhE/mTTRJlwvgMsMs8AAkSiDeMfjRX5PIP0TOnD8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from titan ([79.150.72.99]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N0FxV-1n4IiS04Rz-00xOSP; Sat, 31 Jul 2021 16:54:03 +0200 Date: Sat, 31 Jul 2021 16:53:59 +0200 From: Len Baker To: Robin Murphy , David Laight , 'Geert Uytterhoeven' Cc: Len Baker , Kees Cook , Andy Gross , Bjorn Andersson , Magnus Damm , Santosh Shilimkar , "linux-hardening@vger.kernel.org" , linux-arm-msm , Linux Kernel Mailing List , Linux-Renesas , Linux ARM Subject: Re: [PATCH] drivers/soc: Remove all strcpy() uses in favor of strscpy() Message-ID: <20210731140620.GC1979@titan> References: <20210725151434.7122-1-len.baker@gmx.com> <80f4574c9f6c4c6780735b0fffd83363@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:CPIGMjcOPSVTZO7Gzwh9hg7OmO3+oHEOG/0hwDtVK02HC8v0C/H VZtjWWWA7ZfqdoNIu89W/7fLWalj2kCOTQKhAxS6lFF7AoLoeM0lcDEuqjYIj+iDuALWlr/ e3w2i4JYbm+getruIVMJJX4rXzTrv9aobAHUAs0KWlJnXuZM0dUDqdXEBq34FlTZeIDneQi IY/Xc6Mh+O9qwxxy5/a2A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KDOOqXKprFU=:aKLa3NCS3Zzhe89gSTB7xm S5gbutCNag4xoaxDSSedPJyiapV+RHqXoXWOVHnzxjYUqTVPUWOOwNtWAZU+fJzeJORs/1SIP 1OoRhLNgfQkGczk6bUZdlH2HOoIntYsgaEo2I8dYaa315q5tymP0d6v35fBmn7r0rqi3yyIvD fnRyTbhf4CpNTGkwzqL/GNynOwbwPOCiYepKBmYGjoPs5/OWOi2DkB4eniekMTX939uyE5FRp hb9igUS8h0EzaDJBHtT3jvgRo7I814KSRArIfYkr8PKUi3CPx+7nz1GV3dDJQzfDEyW2tvDVN 16j6laKhMmY7HJot8t8/3fuO9pjJ1Uqv3vAeB4m63iki7BcSqAVZdICPm4qDzsypfDOifWsZn njKRzbVxf/DJz4SSXxTLG7NvKG6q9luBbLuLMTqb68BAhuTStnCXPHLMOQ6Anb/hTqux8TBgK 5zyLmFxWrVW/fym5geK0gR/HmPJKyPb5iPV7aPv35WRqzIMOHYBtm1j4Usow5DIc74U+cPtBu LPyYMZv2bmFdTN1UhsPfjWzqioQbqIp02W53VhzsGLXFptkIATwTRZybyrRVgC0UaEjjrRvY8 RJm8jUx8q5cRCc7SZ0ez8w/CbjUUfmQs37vC91tRCE2uleFh6I7kadGtttDvyzSQpMAmoiEBo YhgqS68ZYcpBfcNPhkj7ExTUx27Gg9Z3KUa5MHb5UveIjFTToZgINcXiAoY7pRUTppTMIp+eV T1sVwKiIbd0jCO6TN5v8Pp4bIXTimprkGOY7BCcIzux04RKjoeUBx+sOeiUt74TVKVccLK/Fm Oy3VJzdCuUUUpC2cxwxs2XODerg1L/8q6rQ4oLM068fqyfqi0tZ1b4JFNUryfZF6oUkS6ivwc aBTvLmQDpJmvInRrFoyusUI4JicfOQhGX+/MzBxDIZfAJ5m19UtUJNpB9rL4DZaVne0g+Il+g WChV2VUBnwM4CkHcXL+dTdeopZoSeqRb6qH53Ym39g/HAdOYTnQxxVgwLgYppTc31pupCyI2l 8xy18lw1WuX4wUCFHbzoEX2h7WPeQh3USpSqNvD49Kl1SZpuHlKajG1pzSniqADZDtCgHFQMs 65fiqzh7iwOd1lv68wDU0pl4hVOG9CnvXln Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jul 28, 2021 at 10:36:09AM +0100, Robin Murphy wrote: > On 2021-07-28 09:36, David Laight wrote: > > > > - strcpy(pd->name, area->name); > > > > + strscpy(pd->name, area->name, area_name_size); > > > > You can just use memcpy(). > > Indeed. In fact I'd go as far as saying that it might be worth teaching > static checkers to recognise patterns that boil down to strscpy(dst, src= , > strlen(src) + 1) and flag them as suspect, because AFAICS that would alw= ays > represent either an unnecessarily elaborate memcpy(), or far worse just = an > obfuscated strcpy(). Ok, I will use the memcpy function instead of strscpy. Thanks for the feedback. > > Robin. Regards, Len