Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4715707rdb; Fri, 15 Sep 2023 10:03:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzs7yo1akZ0Xh6Jabpj/TJ/WAzQ+DY9vN8jjRokuG2BC5Isn/uW1BDW4gO0Bc8vdEupEF8 X-Received: by 2002:a17:903:496:b0:1c3:25ba:e204 with SMTP id jj22-20020a170903049600b001c325bae204mr1713295plb.54.1694797385594; Fri, 15 Sep 2023 10:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694797385; cv=none; d=google.com; s=arc-20160816; b=T1RCYtQGFVHoSu6c/bttclx/dw8iYrG+3WfMeZCLABJsh/jpRdqOmTcf4MvZc5Mdn2 6vYUU4b20L1TzZcRfACX60K4tcmHoAmUkVDnYoIMoz+ot1As/xBgHP5l+9pc6XHq2VaK aDRG0sgfWX8IWXoXfEGBwV6CQlxtK4aJPx929MhUULBzGDJW3OiBT/UOjokv6ni0Zxu/ qz90SgMhCiObSKeeEyA1vAinr1yuQ4gAhbC7oQ+GWuax+AKExkdKxf96NpKs9aEDm0c1 fcvfCK09BeG/arGksQhKz7WVqufSYrpvFlFdXJb+JWjD4cJ2u923Nai0wzyNqAFuXr9g q0ng== 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=W+CQX+PQxv7bZvfqrrCiK8lwgG8+dPJOJah21/aVynY=; fh=+hSkobYEN4SOba4bzh9XKd5YEUggFPWb4inffllNhKY=; b=gV9IV8yowc60ucavDc+hNfRLSzSwEJEn5YlXgg5q7e9AQP/XtHpSzTLz8K8P8h8OY0 JB0P9Oz5CtcFv2Opo+96PQbyGY10R7tiAtR8AZgQ4zC7qfiFodPO8JT5t05xmdovKpk1 HoqWP8OE89HGOtsJmEU8AN6vEp9er76St7PqfRR+w8PgjPPssi2K2bKum3J3dTbLSZ7r v9weDs6Pj+lyNqMHs0RnW4Pkka5uOQrOHWGBi48AhqguGd+hNm+imD7bI5YHxID+IHOX oS7m2GqBwFzLIk1QhhOo/CLwGnBhePaPv7JIie/oZEy7OinoT4ZQbTMs9foCbXszfSYN Og2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HDSz4gS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id a2-20020a170902ecc200b001c446b59c8dsi451328plh.271.2023.09.15.10.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:03:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HDSz4gS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3AA9A8050929; Fri, 15 Sep 2023 05:40:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234954AbjIOMkz (ORCPT + 99 others); Fri, 15 Sep 2023 08:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbjIOMkx (ORCPT ); Fri, 15 Sep 2023 08:40:53 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C9EA1; Fri, 15 Sep 2023 05:40:48 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38FCec0M060781; Fri, 15 Sep 2023 07:40:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1694781638; bh=W+CQX+PQxv7bZvfqrrCiK8lwgG8+dPJOJah21/aVynY=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=HDSz4gS83suDNv9dLJr3RRMgy/o/W/oarhr13csUiPMqyop3iCWqnMnWCp/BnOv0H xXOWv/1qpriK2sfSRIXyRwWE/E91pT8ok2Ztsr/BAGsKGsPHsrSm8VhloIZw4bRDFL uzgjzat3VmibbLX1HBQ4tHc61xpZ7CCAvqw3/EiA= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38FCectL113296 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Sep 2023 07:40:38 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 15 Sep 2023 07:40:38 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 15 Sep 2023 07:40:38 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38FCecso012546; Fri, 15 Sep 2023 07:40:38 -0500 Date: Fri, 15 Sep 2023 07:40:38 -0500 From: Nishanth Menon To: Kees Cook CC: Justin Stitt , Tero Kristo , Santosh Shilimkar , , , Subject: Re: [PATCH] firmware: ti_sci: refactor deprecated strncpy Message-ID: <20230915124038.vmj3gzthboypzp3v@parsnip> References: <20230913-strncpy-drivers-firmware-ti_sci-c-v1-1-740db471110d@google.com> <202309142103.6DFFDEB@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <202309142103.6DFFDEB@keescook> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:40:58 -0700 (PDT) On 21:03-20230914, Kees Cook wrote: > On Wed, Sep 13, 2023 at 08:23:02PM +0000, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > > > We should prefer more robust and less ambiguous string interfaces. > > > > A suitable replacement is `strscpy` [2] due to the fact that it guarantees > > NUL-termination on the destination buffer. > > > > It does not seem like `ver->firmware_description` requires NUL-padding > > (which is a behavior that strncpy provides) but if it does let's opt for > > `strscpy_pad()`. > > > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > > Link: https://github.com/KSPP/linux/issues/90 > > Cc: linux-hardening@vger.kernel.org > > Signed-off-by: Justin Stitt > > Looks right to me. > > Reviewed-by: Kees Cook Does this belong to stable as well? If so, please add appropriate stable process. -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D