Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp991210rdb; Fri, 1 Dec 2023 04:27:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC12xp/iPphJ8L41EavksE9aGBbUEHh41SIUlc2KlUeKxSYKQ4Z4O/tIipTKMDmVC6eXmn X-Received: by 2002:a17:902:7e4b:b0:1d0:5878:d4e3 with SMTP id a11-20020a1709027e4b00b001d05878d4e3mr735319pln.9.1701433641802; Fri, 01 Dec 2023 04:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701433641; cv=none; d=google.com; s=arc-20160816; b=OkO1cjKwrxDBMdjTu9IQzW94kBGY9ZNafHFKB/lpwzYotaw8jJHT0ZOukpCoEXNQjt tlLDvFzbIKjm0HALeDPWjcZ0/W6Lvj38jYU77hPvTlSL+g4ywiGRN+a3zqBpQgGfaYQn 1pPuY3+iUIf7LLbgwv2wsjHM0fqk9H6z8sgp2X6ridryknT+Jrql6rQXDzhAi1WPWa4e jo5aKoXkkdiNPc6X7FMpPdO3prdboEbC0r1AgqmDafKzraKWvDt3CqbsgDb8Z0ej3dZ3 PpnOQd7U6gK1WFNCYy5qZ5recq5JS1ztI3XM9YcGW6b3Lyu6fmoPwrffgn1jV8yrrrYz x2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=wGKU4LoXxQKfA71jmoxcM0sCsr2+DQFAN0Tf1QJjNUs=; fh=CsnhYv41EhyAtpAjyGwo69vEW29KERMhAdpo45xcLjI=; b=mucmOReo2A9uN1GZZWcc4+znUUyTKxPffEz+T0nTV2nqBzIGPeS3emb7MgK099qcmn wIjZRG+qOMj1K9J0WUp+nylT8f76eKXe7DJsd062aEfZJEArRogrEhdvsQ0RMwa3CDBl v6tDJ287DtzwcnF70gxUhOHNoZPdy+h8oObumUXyJZF/5R6Yz8XUMDTIGZZNaiiUOjEZ dx2NBdCYdN0+ntG8t8Jts61O2xtFhoS5tCdmCpU6h546zPjJJr3vMnHswLJ1np8Mpb9t VF8Uf1Cf5Nf4ltw0115p8+j/rD5VhflICwEbxw6Ymx6x8wijcORyQdD2wcHmtdzQpKAe VHjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CM8B1w5k; spf=pass (google.com: domain of linux-wireless+bounces-291-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-291-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s7-20020a170902b18700b001cfc018b4b5si3055186plr.529.2023.12.01.04.27.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 04:27:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-291-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CM8B1w5k; spf=pass (google.com: domain of linux-wireless+bounces-291-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-291-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 49533281563 for ; Fri, 1 Dec 2023 12:27:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2F8524B58; Fri, 1 Dec 2023 12:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CM8B1w5k" 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 BF7BB21A13; Fri, 1 Dec 2023 12:27:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 463ABC433C8; Fri, 1 Dec 2023 12:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701433638; bh=VLf9TWayJPl8TT4+DSau+I8bCfyYcFQKiuZmn9PQq5M=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=CM8B1w5kfjRuNR50iBGF18msF6xVUXENaYt9iSsjPuYmbCGOhHR6lVYoGV/eLiEIA fFqGE0jRrEImgYMm4Oq6pK6iCvVYadEEPHUNEzakNGKb/RRdfEl5MDZ/WqL4er8lEW u+SBIZLvmEDq1+p1oYDDeQ1gH4AIbFFfKO4064c13kXghVFvJ1qPckwhUwTxxKRig8 D+MMfSi6MTm2grtTtxWZbWEeOjWzx43ZSAU54z1iEyWyYFDDCUYIJ8Ts3XVferFZZC Zk0J39sxjiGIltm1e8SiQLT2V0CO6Z3mtp1jln1NCIpOXzDm3B9k89C1ComQ3LOHD6 mWqCRaqXMbqKQ== From: Kalle Valo To: Kees Cook Cc: Justin Stitt , Gregory Greenman , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] wifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad References: <20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com> <202311301354.0DAC97C@keescook> Date: Fri, 01 Dec 2023 14:27:15 +0200 In-Reply-To: <202311301354.0DAC97C@keescook> (Kees Cook's message of "Thu, 30 Nov 2023 13:55:04 -0800") Message-ID: <874jh2rtuk.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Kees Cook writes: > On Thu, Oct 19, 2023 at 05:44:59PM +0000, 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 > > Thread ping. Can the wireless folks please pick this up? Yeah, I'll take this directly to wireless-next. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches