From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EBE8EED61A for ; Fri, 15 Sep 2023 17:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6jSKgpqDabMKo57TWMWYLbXxf2wmqdu+nomkzYgCcmg=; b=hAKDKjwxudKJHB ZGsyhUQYZzC6dkYKJpFyKaUjwH/4EuLCPJYK3xcX+nrkJ6l9QwVMrl5AsRqaawzVqFPnP4NYF8qsU 7/3s7uSb6E5SibQgSBp6xJk2AseZKcrBueiwOkXV+WKvWvcLxM7Zl7mfc3pCnZirPFFzQZhKfKLaQ NIVO7hwzeEGqaMYu3n1EKlFKtivybqIiDGEruPnR4YJpwtyMW6V8TYaBwv62A464D5zpUelYAyzrI shuNXzElHRQu1WWhBz85N52cqu0xxcQCuT3KzX+GCp4vNlf3y/E8hZ64AL0d3q6OHEp3KLH9sOX9t unxAQenm0D1p9hOfbseg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhCNu-00B7Xe-2O; Fri, 15 Sep 2023 17:13:38 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhCNr-00B7XE-2B for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 17:13:37 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-68fb7fb537dso2253481b3a.2 for ; Fri, 15 Sep 2023 10:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694798014; x=1695402814; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fRHJ/RTdkjV1T7VQMz3Gh8DiS1ERKAhw13PCyOr4quI=; b=mopI+kNxt64rW8z+olfhkKKmpaTBN1uScUSyEvkNDDAPRMgQNsrh0AnOg1FRMkaly8 vq7LMKWfza7nz6N1vEAVepkaY2GSyGdUZGBRj1lz3Og5IhURlkXVPXgRpYCCu5H6Ockm 6dvSgUTdn9kNyoxqG48ALiwqXEikvuRhhnWTw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694798014; x=1695402814; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fRHJ/RTdkjV1T7VQMz3Gh8DiS1ERKAhw13PCyOr4quI=; b=Q/hLHKMrTCKVN5xi/NYls3dC1sUa93HtAEs0hIc4yLKwqmatgsHRxk58rHwLJiTjjT a9Z03fr8jiq94fb55D5Y3YuG4DtLN+TIgegoFE4frpniWaxF9C1nbPG8x6S8CoAUNar/ WOwIP9DwtHcQ2MClR7Rz8X4rERnwzRO22Yx6weE6hcOL4d/nnx39kM3DckZDjnjYapl9 AlrSVX/AgVyB+3XLWVAXFW2szZjq3a5gcYuqL2BVHNIuWgExiI5+WCoosLjdsNX6Zy6V qC3JKcyT+xDJn/kcyo/yKOXFKFhTa5INMTKBqhGeYj1W8FyrLkoQJZBepljCXtYxaPU1 UXXQ== X-Gm-Message-State: AOJu0Ywx5pBEihgbLVJox+GhoW8ABKgP9mv1OXZPX8LAcZPiTjZEjK9e FGp3SBYS7HhRXXeszZ5RAtSq/w== X-Google-Smtp-Source: AGHT+IEJoJES88+Guv1IYodwJB+0lLZf+yalUNfYiexFIPINgKTeK/Z0sDBr642L1qn2LfQeqyMcvQ== X-Received: by 2002:a05:6a20:8f0c:b0:159:e0b9:bd02 with SMTP id b12-20020a056a208f0c00b00159e0b9bd02mr3278129pzk.40.1694798014413; Fri, 15 Sep 2023 10:13:34 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id j15-20020a633c0f000000b00565009a97f0sm2965476pga.17.2023.09.15.10.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:13:33 -0700 (PDT) Date: Fri, 15 Sep 2023 10:13:32 -0700 From: Kees Cook To: Nishanth Menon Cc: Justin Stitt , Tero Kristo , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] firmware: ti_sci: refactor deprecated strncpy Message-ID: <202309151012.446CC82E2@keescook> References: <20230913-strncpy-drivers-firmware-ti_sci-c-v1-1-740db471110d@google.com> <202309142103.6DFFDEB@keescook> <20230915124038.vmj3gzthboypzp3v@parsnip> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230915124038.vmj3gzthboypzp3v@parsnip> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230915_101335_732574_89674365 X-CRM114-Status: GOOD ( 18.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 15, 2023 at 07:40:38AM -0500, Nishanth Menon wrote: > 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. No need. This is a refactoring only. :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel