Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5820061rwd; Wed, 24 May 2023 07:13:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61DCHf2rCkR0LZ+2MaTpomzrYe8yKsFQwSmlihzwr35W2NeC5d9na5JS8xdOwp6zAVX9gd X-Received: by 2002:a05:6a00:218b:b0:643:9ca:3c7d with SMTP id h11-20020a056a00218b00b0064309ca3c7dmr3916037pfi.4.1684937594636; Wed, 24 May 2023 07:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684937594; cv=none; d=google.com; s=arc-20160816; b=s1dsI31UL4G1OsV7nD/z84bO3Pxs2QOJLosy77dP1cNWu6X0af77XF3NVTKHrUXUuK jK3w6ctFrwLi0gspyxUi+c8I2/tWBlyEts+4rQ6fHc8CBTEs6HjByJ0Y8QMMjilH+AP7 CWcMhSg9tkMmHQVNoeCBVmDYEJhvXhzGyFZjcFiU7RgUk5xcEdCZWUuS1GDp1DpHhESc 4jA/v5yUwuYXHVAJEuYlFh90g0as034EtOup6+5/bzfHLGmFm56CbjsWcTX52RRy2YlU YbFOTIGHt/tVnmSJGy/2EH54dFmBVqxMaxgR6KI1KGncEpnw8kRrw+Pdo6VwMPi8bmZB GMgQ== 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; bh=/eEJ6jP3QIlGYuvOlx/eC8dEsPvABcs26C+hXbLIg38=; b=a+iKccZClco8i6JmQ1di4o/EG0Wt54HUl6hQUV66TP28lQLzAhq7WDm1c8p2LsCVQN i5OjI/R2Xp7rxj2MSotoSSzS91A807Bb4WrYL360fFsz7+JjW41MRHlsA97ZtQX1+a3E s1oZDjHLGG1cMFg+VvqSjUPSu5LcA85gFspnqhgPqJnboxQF26Fx0Y77UYQ772pkLePs RJacokOxm7i18OmjgdngVGwsqochxueb+6irmn5vRMT7i39kq5zHDWF2BkJ6a3kr4uyM r9TG7clIGs3iooh9ihIs/AXkKKIc6vWATWHtoqizqB3Wg91yx7HtCuJBTEF526uJN1bD Ejsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020aa79736000000b0063b8f0a6f51si3231202pfg.117.2023.05.24.07.13.01; Wed, 24 May 2023 07:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235363AbjEXNlF (ORCPT + 99 others); Wed, 24 May 2023 09:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235338AbjEXNlD (ORCPT ); Wed, 24 May 2023 09:41:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCCF19D; Wed, 24 May 2023 06:40:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C984A63554; Wed, 24 May 2023 13:40:34 +0000 (UTC) Received: from rdvivi-mobl4 (unknown [192.55.54.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPSA id 65486C433D2; Wed, 24 May 2023 13:40:31 +0000 (UTC) Date: Wed, 24 May 2023 09:40:28 -0400 From: Rodrigo Vivi To: Kees Cook Cc: Azeem Shaikh , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , linux-hardening@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , John Harrison , Matthew Brost , Ashutosh Dixit , Lionel Landwerlin , Umesh Nerlige Ramappa , dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/i915: Replace all non-returning strlcpy with strscpy Message-ID: References: <20230522155228.2336755-1-azeemshaikh38@gmail.com> <202305221316.2817AA4FC@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202305221316.2817AA4FC@keescook> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2023 at 01:16:03PM -0700, Kees Cook wrote: > On Mon, May 22, 2023 at 03:52:28PM +0000, Azeem Shaikh wrote: > > strlcpy() reads the entire source buffer first. > > This read may exceed the destination size limit. > > This is both inefficient and can lead to linear read > > overflows if a source string is not NUL-terminated [1]. > > In an effort to remove strlcpy() completely [2], replace > > strlcpy() here with strscpy(). > > No return values were used, so direct replacement is safe. > > > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy > > [2] https://github.com/KSPP/linux/issues/89 > > > > Signed-off-by: Azeem Shaikh > > Reviewed-by: Kees Cook pushed to drm-intel-next. Thanks for the patch and review. > > -- > Kees Cook