Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp998091rdb; Fri, 1 Dec 2023 04:39:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8ziN3qBLmaPEJJoLFiemf8T4/+0euRQbZWh+Cex53AHk8ma1zQ+fwMtvBJedSBBe05GGJ X-Received: by 2002:a05:6e02:17c5:b0:35c:f2f6:7b1b with SMTP id z5-20020a056e0217c500b0035cf2f67b1bmr20897026ilu.26.1701434348578; Fri, 01 Dec 2023 04:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701434348; cv=none; d=google.com; s=arc-20160816; b=H+wJsifVANQ73H+aM947fcAhJVcWUhjDfLvexfcctgG1IB/9Qa50Ic5wr83y+Gn1ty FDeBIDtPOSBrs1UY9aQdbwOheFoIUlxCsqECyxDO+nkrY7QWist0nxuNX1e7Vx5v5m/Y zlnkpEeLl3kZYq+GLJFdgaY8JKqR98GQWsuZphNHrvGjYgXqkOtCgBMBk1RkzvVx92CI fYD/LCvI1CobfCmMDNxASXGYzdtE3xPzXX0TIWKQBoxE8jg8amhJpl3/2j0gG62keFNW q1cImA8NidMMo+4z4VazrF7p84ON+ls9wgh6FnnqX1/qmsIoZ0jfrhoUf1kTIWFgJEIZ UP3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=iRLL7VjNZVxjmZVDLtbAv1wLaBTh5A41HgqCI/zRnHc=; fh=zXUHZgI6LxB0tQPUGSSheTGCFuCjX/OH6r+aXp5NnkU=; b=MvrdJRa0mQlEoTZQe9q2QCpzBlOC+dy0E/M8d1ne5T1Qo4HuWuMbbv2OVv/yrJi0Jl gA8VFeQ1mLz9nHZIb31+St24PP+7IFzI3wf7VLXy3dKoJFngtzH8X0nY3VSu0tK2DAPZ Z8iN8Wx3l43xuVjGdveonXF1nYNwmSgFFCDse3oa23dcLLXEme93EFJ9NFmTs/8DuCn5 ziIygfKcoJGs3k2ToSD6zvHjPdvZcpW8fUKz4hQEbjClUH0STOhUKQN1m2tJUamToCA9 CCHCBLtk9WnIzhtwJlrXJJmScQP8/N460tJbV1+MY2xSOB6O3AKdy7RlvKLViu6Egt// 6Ctw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmOMEFfW; spf=pass (google.com: domain of linux-wireless+bounces-292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j23-20020a63cf17000000b005c1b30b1b65si3194228pgg.648.2023.12.01.04.39.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 04:39:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmOMEFfW; spf=pass (google.com: domain of linux-wireless+bounces-292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 814F4B21065 for ; Fri, 1 Dec 2023 12:39:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D556720B29; Fri, 1 Dec 2023 12:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NmOMEFfW" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADE8025554; Fri, 1 Dec 2023 12:39:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7840C433C9; Fri, 1 Dec 2023 12:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701434344; bh=35D2snuMpVehcg+ViRKqORPYjANnyd0dWZydo9aQjGQ=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=NmOMEFfW6fJYpHz4HPWPs01Kdiw9UkXJlzEdrOuD5JqZaYVuO0EDaw1fynUZXiQh/ hbEAjKNi0Pwgm+nLj3zAYSZJIZrWxm1Q1lc/dLirL2phsLIEg6Od3fJlN8r6VLhcw7 BCiamNIgbUrWDteWyqzbt1IUNhkXRcS0FehssX2g1dY1Fii1ZEbdDzxJXP9LRh9WaL pTAi3UTr3Cl8m8hkIG6T1vjf/JmcG5NZFl9i8z/9Vl68WTGZpsCu4ALXx4lXTwRMRy zsRRLQc1mEor6+rXAaXQUBM5jrcB1YSgBjypU0YyICzR35akLHy6XBv3rTFx8A8unC ZLoIlHUQd1esg== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2] wifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad From: Kalle Valo In-Reply-To: <20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com> References: <20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com> To: Justin Stitt Cc: Gregory Greenman , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Justin Stitt User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170143434079.2072551.9169872706121192136.kvalo@kernel.org> Date: Fri, 1 Dec 2023 12:39:02 +0000 (UTC) Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > Based on the deliberate `sizeof(dest) ... - 1` pattern we can see that > both dump_info->dev_human_readable and dump_info->bus_human_readable are > intended to be NUL-terminated. > > Moreover, since this seems to cross the file boundary let's NUL-pad to > ensure no behavior change. > > strscpy_pad() covers both the NUL-termination and NUL-padding, let's use > it. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > Reviewed-by: Kees Cook Patch applied to wireless-next.git, thanks. 70582e26f5d9 wifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad -- https://patchwork.kernel.org/project/linux-wireless/patch/20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches