Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4383650rdb; Thu, 14 Sep 2023 23:42:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhvJtXswYX3doPyWjZC8WjO9vjA+shaoGmbP3XJWdPu6u/3jFaFz+14oXw0Yd8Njwe08Go X-Received: by 2002:a05:6358:e483:b0:13c:ec81:c276 with SMTP id by3-20020a056358e48300b0013cec81c276mr1181629rwb.5.1694760123171; Thu, 14 Sep 2023 23:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694760123; cv=none; d=google.com; s=arc-20160816; b=L8ufYdxvMyZRUbW47wzwEkblKYSDf+Tm5qTaGxZRB79b1Jbi2MAFOhIRwrN7zl0Tuo mfEBlupjKuk1pKl+uWvxChPStRtWdNbyXMQ9eNTWMmhF+D4sC8KH8vO8hqMY7EQJDcP9 ebyWBfQgpKcoZuO1/+kKM9soxyF7C9w1dgzIDQGhKsECPkPCC3NXhfm0WrnOoVBReHLo Yoh16ZujQTI7JTU3D5hzclEIgEkHw8l+BXQ1bHURwUyoEsh9EXfh8CWS+LAfsWNhSse/ p2MUbdetLrmQxGv2AzIUd30lvpC7BzL8DpeV2oG+yrdWa1aIYKjSgWgr/MPqerD+FQ0w nT5g== 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=KrkAHIjQDGiDP5wEakotxifTSwpH8QMLY2bspVz+a84=; fh=Lzt/TliXbdCTExXRWtO/39v5sbP5XBJEzcz+SavNaco=; b=wEkPUiprY/FDqjNeVTD9hSPdyPl/hXOVbmRVTwbs33KQYjpApCf3KwqWHbT0IXf6+0 ZqsxOSZ6B3knPzW8BwXqcrukUphdIxOkj4YtMe3VHoxZ6AVKzNXTJxR+FwwFHhTBuycV uxNeHGG/w5f2J2AsCjCDnk6h4jEAWinS8f0+B1Wi2LgTsjupSn+XpAU/XSymACCHMbS4 kEI+ftcor18jipL0Px9jSzS7Q46vKjFJjfzMYh6zhPZZ9ABbwP0+auaUDuATlwPDTTj2 4wJfLhQUfwc3qKa4t9jc5grRjOcZNgBosnmBTZvhIynA6borjLZKaILKhXW7a4HOwhG3 JjqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VacDg1G4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l191-20020a6388c8000000b005572b13d228si2666990pgd.277.2023.09.14.23.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 23:42:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VacDg1G4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5236D8374D9E; Thu, 14 Sep 2023 20:38:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbjIODhw (ORCPT + 99 others); Thu, 14 Sep 2023 23:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231698AbjIODht (ORCPT ); Thu, 14 Sep 2023 23:37:49 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C5E22713 for ; Thu, 14 Sep 2023 20:37:45 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-69042d398b1so389115b3a.0 for ; Thu, 14 Sep 2023 20:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694749065; x=1695353865; darn=vger.kernel.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=KrkAHIjQDGiDP5wEakotxifTSwpH8QMLY2bspVz+a84=; b=VacDg1G4fPqQLceZaZVGmHlkMY1eJ5CbVieHp0oF4+iurLvzRyAMmqqlA+nWn6jARx DvPLfzS3QYOwJ7s4NPpRK+cAFxjM6UTM2fx+wNU8ukTPXAwMBQ36RMeQakzkWxIhFX4y Si0/1B3QuM7M1KkL2lUNt5k02JlJc/1ObmYHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694749065; x=1695353865; 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=KrkAHIjQDGiDP5wEakotxifTSwpH8QMLY2bspVz+a84=; b=Z7xg3W9Nukg3QOK+iJQF3L1H899BYjRvgzCn0wlSbcYEaUlkcBKj/0M9nANOua7lLt piqPPyTk+A/cdBUS+lOXaXdoZM86y+FII07tCyka9aYN8DTF0DqYAL6oK3l4r3CwBz6A H74zboS83RT0/chOOkqZndBmDoLb6Q/0t9Pjsqvq5ijr2IXOdUOlV/wdX+aNDNCNDS5D THJQkFsCtRYB8/EkhpGDp4SvCCVcQ3eH3lvJqEHLNnCqjBdnsntHa15kSFJRG9f7b0EQ bj+tl1Oj69yW2BA2A9KwjeT5HL6e4GZiBVWxkjmIK2j2u79oR/BUIDcHkA+ktbGiJ45m kVMA== X-Gm-Message-State: AOJu0YzigTE60Eey1n+vMFdYjuRVzokUv5roRFhaF6TVrWs52s3tnQps netKNflq6vfz1GsPQTGD6FMPcg== X-Received: by 2002:a05:6a00:189a:b0:68a:6d1a:b812 with SMTP id x26-20020a056a00189a00b0068a6d1ab812mr674679pfh.9.1694749065065; Thu, 14 Sep 2023 20:37:45 -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 f10-20020aa782ca000000b0068fe7e07190sm2011222pfn.3.2023.09.14.20.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 20:37:44 -0700 (PDT) Date: Thu, 14 Sep 2023 20:37:44 -0700 From: Kees Cook To: Justin Stitt Cc: "Rafael J. Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] cpuidle: dt: refactor deprecated strncpy Message-ID: <202309142037.5D689164B@keescook> References: <20230913-strncpy-drivers-cpuidle-dt_idle_states-c-v1-1-d16a0dbe5658@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230913-strncpy-drivers-cpuidle-dt_idle_states-c-v1-1-d16a0dbe5658@google.com> 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 (groat.vger.email [0.0.0.0]); Thu, 14 Sep 2023 20:38:08 -0700 (PDT) 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 groat.vger.email On Wed, Sep 13, 2023 at 12:23:19AM +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. With this, we can also drop > the now unnecessary `CPUIDLE_(NAME|DESC)_LEN - 1` pieces. > > 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 A very regular strncpy/strscpy conversion. :) Reviewed-by: Kees Cook -- Kees Cook