From nobody Fri Jan 9 12:37:06 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05FDFE8FDD1 for ; Wed, 4 Oct 2023 07:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241522AbjJDHlT (ORCPT ); Wed, 4 Oct 2023 03:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241543AbjJDHlQ (ORCPT ); Wed, 4 Oct 2023 03:41:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C128AD; Wed, 4 Oct 2023 00:41:11 -0700 (PDT) Date: Wed, 04 Oct 2023 07:41:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696405269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N3DAeRCTXgcmL6wGVPGeNq0prqCeKyw0QqbONR1xZzA=; b=Q+wQZ0+kZ+Df3U8BgTnZQUMdhZE3NH1TUEbqHW/kRE/0PeUE1ueE734AyeBuuVELApI8Yf eObZh6nDTDMxCCWvrAomMqgvlGCiu7T7P6B8+ljoR4xEwQS4k9mX9x/hG1o2InJ0qA4hd8 +pKt1UdZfPgKeuYHi2xCzQsSaYx29d5h6Vow2xAND9EHI3PhW0ht3O6BH8H2LHHyjbRLJn 6xYobE47r5Y+F+4aDxRRvjBM/cH3wuF6QPnaiPJRW9+8doGF6ZwcY+U5zxI8/OTEqJfCW5 5ri7rtAzAV6AOfg2jAZdAF4jmPDdOBZeUJ+UkHGMSNZMK04qB47LBPkW1shosQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696405269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N3DAeRCTXgcmL6wGVPGeNq0prqCeKyw0QqbONR1xZzA=; b=YziiVtxsZ1a8Jf5cVXyQ7mu4FCn3bG8pZhRWIt7QOBXwC9SjsDEtR9IRdm2KqO7ZNHpv87 b1fNN8FaqoCt/VDQ== From: "tip-bot2 for Justin Stitt" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/tdx: Replace deprecated strncpy() with strtomem_pad() Cc: Justin Stitt , Ingo Molnar , Kees Cook , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> References: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> MIME-Version: 1.0 Message-ID: <169640526821.3135.14252605949556446798.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/mm branch of tip: Commit-ID: c9babd5d95abf3fae6e798605ce5cac98e08daf9 Gitweb: https://git.kernel.org/tip/c9babd5d95abf3fae6e798605ce5cac98= e08daf9 Author: Justin Stitt AuthorDate: Tue, 03 Oct 2023 21:54:59=20 Committer: Ingo Molnar CommitterDate: Wed, 04 Oct 2023 09:34:07 +02:00 x86/tdx: Replace deprecated strncpy() with strtomem_pad() strncpy() works perfectly here in all cases, however, it is deprecated and as such we should prefer more robust and less ambiguous string APIs: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-= on-nul-terminated-strings Let's use strtomem_pad() as this matches the functionality of strncpy() and is _not_ deprecated. Signed-off-by: Justin Stitt Signed-off-by: Ingo Molnar Reviewed-by: Kees Cook Acked-by: Dave Hansen Link: https://github.com/KSPP/linux/issues/90 Link: https://lore.kernel.org/r/20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2= -1-0bd21174a217@google.com --- arch/x86/coco/tdx/tdx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 1d6b863..2e1be59 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -119,7 +119,7 @@ static void __noreturn tdx_panic(const char *msg) } message; =20 /* VMM assumes '\0' in byte 65, if the message took all 64 bytes */ - strncpy(message.str, msg, 64); + strtomem_pad(message.str, msg, '\0'); =20 args.r8 =3D message.r8; args.r9 =3D message.r9;