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 A11F4EE3F01 for ; Fri, 15 Sep 2023 04:04:04 +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=ta9CTVGjmYlSYec5ek8CRfICLnCfXYOUKLkKRVLtsO8=; b=dHR3S++jk0xyh2 0sdp81g7CE9mlQCBg/PhBVcZKMPllz/zX200nacGFIoh+Or8zhKAvZ8objBGtrPY3rIqIpNqFQcu4 fffRCUQJwqQdElX2kmaEZZv9wzJYpMU3TFFAZQa+EQ7mZC2E9q2D77xvSAdYED9O10JhZ94fbhlrD oI6tXCqyf2317NtZjlh56tAzQIrEdAB8EP52/gRARiT8i9ezE5TW0V2U/2ttf/1xoHIfnisJ8mQxg oyC+YNQed+WMViRV51u99z9bAJzfaCx+la4O7DvuwT46NK3ZfxrliCpooxK/Ez5brz2wIwAsZXq19 I9jWWoRJ2x0FY0iJ0KMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qh03M-009iKs-0w; Fri, 15 Sep 2023 04:03:36 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qh03I-009iKI-3C for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 04:03:34 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-68fc1bbc94eso1434175b3a.3 for ; Thu, 14 Sep 2023 21:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694750610; x=1695355410; 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=bdckIkCIpFym7NUpRG7gX2O8Kgm1I4+FpTJ9+N9Nf8w=; b=CTGlbwW/7QtbiUGTDM9QpXAQ082Nv3HJrhk3VKNNoPr2xeO02wZsjbsSGuX5Fvu+8Y mqWF/j6B1QWlFF2vNSGRYQSoHj4WJr2CATQ5RDegRbIAiV+XEoROKATsbbpbUzdaPU3q BzIhIIdXhgcCt4fVVWX3oJPNT67XOF2oKHKL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694750610; x=1695355410; 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=bdckIkCIpFym7NUpRG7gX2O8Kgm1I4+FpTJ9+N9Nf8w=; b=eadU5Cbm0zJlAl1hSzIC2ZMbHkL4ZbPc3NJNF+bjKoG5iwHyaDO7V1XhVjLXID+COP ctVP7zZX95MlBV+W6QNnuvSiZK9OlBYtjdyM3jr4AJbQPB0DwxIMdvPK6oGHcQ+w7OS8 TrsfIn7LsJWAMy/f1pWRslA4Gx37nq8vbP47v4mkuyqL193WgWniS4OXksRBlFkiTcQG e+9BWmBRQ8yqm4fH9jHZoR5XUj+7Uuei+NpRe0W2vWQwAXFhbTpocHDw3aWc/c8VF7yP HzQEhk26TO+wB4Owg3R6Quf2XPvxjBhHNGH9lOqlepPMo+GyNS8uqn2OuS8MPSNGCF9D pJNQ== X-Gm-Message-State: AOJu0YxagSf1c19fY3PS6peqInLozEQ+WQZh6IRdlRG8bcA9DZTyLIAW QCBOASjECTuj0frTJeJLpR8ZnQ== X-Google-Smtp-Source: AGHT+IEE1WYc4bw/B4ik03Qzn2D6jVmzYFDS1WbU6ybgM/bCKoZwSIktSE3iQqs/niV/77/brIgkqw== X-Received: by 2002:a05:6a20:3ca1:b0:14d:a97c:911 with SMTP id b33-20020a056a203ca100b0014da97c0911mr866067pzj.5.1694750609891; Thu, 14 Sep 2023 21:03:29 -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 a9-20020a170902ee8900b001bf095dfb76sm2336357pld.237.2023.09.14.21.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 21:03:29 -0700 (PDT) Date: Thu, 14 Sep 2023 21:03:29 -0700 From: Kees Cook To: Justin Stitt Cc: Nishanth Menon , 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: <202309142103.6DFFDEB@keescook> References: <20230913-strncpy-drivers-firmware-ti_sci-c-v1-1-740db471110d@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230913-strncpy-drivers-firmware-ti_sci-c-v1-1-740db471110d@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_210333_036970_F250D134 X-CRM114-Status: GOOD ( 14.02 ) 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 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 -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel