Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp51378lqk; Wed, 13 Mar 2024 16:10:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd1aslw289ild8UxDgsi3sGhn97HMWusut4RrL7XdIuyV2a48S84iO1FZmAzBiQbSXOARsJRDnkRpNDKzGlM9lbbQxzDmLYZ/LVq1mvA== X-Google-Smtp-Source: AGHT+IFxbs+7HoA6wqTnPOVjYczhxvgG2IiDEXEse06G+ABgc91k7NLWS3mSYdEa6utDRm2cgyUD X-Received: by 2002:a05:6512:48cf:b0:513:c25b:8fe with SMTP id er15-20020a05651248cf00b00513c25b08femr4156003lfb.58.1710371418681; Wed, 13 Mar 2024 16:10:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710371418; cv=pass; d=google.com; s=arc-20160816; b=rtGNx+76zBvySX+7mlfNet9As24TeJfmwqicwof05omOMjh7lbSzaYJpT7jME/Edqm 99Nn2CerK5P0ipPp8oOtykA9fwGvPvSHQUzXG3B8+nhYZXTZtI+h8XOE9kgoWasQ2UWO I4g9R+C6ycDYWTtEg+hGA4JPKYxxxj+IPrZgnBwmTAX+Cu1eHDF75523AyVYIo3s6EOI Dbb4+ZwMEDpPMNZBWjRLDjf0Orm7F2VmhVZ0dSIzqpke8oiaV6waV715kNFmCvvXMGPX WFl/vdlnUF5iucZrJfl7jHgOMzNhv45j0PeUSiScFG/tja8N/Eh1W6vvIp6CgDttX+4g S5Gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:message-id:subject:cc :from:to:date:dkim-signature; bh=rYZPrBzSjkyRIMR5GIwY/KAK6jPdoSu7grZu7ns8X4Q=; fh=yeXsI8//DSGZiVxtyR5ET28pxgVz1LDc/MoOiAINWUA=; b=lJvxTxQ9XtXNPfjeswXerzsUgedcbUbtF4DsCRc4p1Z6jheBpSixjlS5+Crdtf0NQ0 Ma3SXY0Z17EWWvegJFdHHK7DmVszrMOSd9qtWDm59lCjK0B3LrLY8aEHoZw4xPMehdRU Wjsfr7oOt9A7s0a+2wUk/6yUJFowcayC1/IbikP0QRHqzUyi66tG2tcrngu42nHQHlXQ ub+4jqcDkGhojykzhVl163bnQUIzSWqGYcF5plbIsFMCG7208MWs1BJMyDyNPaqiEZbY gqphjdbbbiyL5flUdmdHFYHiPJUjwjZfdPDbBV44pqwSAFDCGd1b+MJj3HzA4RAylGLJ zk9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=3qu2niw75nb2xbjezbisjc3dce.protonmail header.b=fTo9IO2q; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-102631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id oy26-20020a170907105a00b00a44baa5e3c4si109546ejb.270.2024.03.13.16.10.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 16:10:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=3qu2niw75nb2xbjezbisjc3dce.protonmail header.b=fTo9IO2q; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-102631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6478D1F22A30 for ; Wed, 13 Mar 2024 23:10:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DFE85D725; Wed, 13 Mar 2024 23:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="fTo9IO2q" Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (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 719115CDE1 for ; Wed, 13 Mar 2024 23:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710371409; cv=none; b=HPMGMTWiABzJN+OrkPZBNZW8uTO5aBmuQX6d6KOyJPho1QCDEtT3BzQGn/LfoPDos3KMxYgYNobBV55V6oSVuXirmR6gCVa4Fx1QKqjez0uaOCNMJA8lR9TgD/c3gCF53Sk2fAw/QlAARi+QcPMB1n6A5Pe5jpr2d4AUgCWfRRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710371409; c=relaxed/simple; bh=kdHGNf15Fkji+Yncd0qKZLXXXshvhJrNdSwpkSrHW2E=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=i8gCEcbKro5Jt0PiPUVRbX7aqhw36G6aPB+HOg5duUmdLRI0YZacUDu/D9i355B7LrLST78wV0ylaJmLxzjgOxJTSsNpfxB6vNk1FiVtV9NqSWUbZcUzeIyYPyWR0zUh2+FcJMmNm7sWznUdvelZCuybokUlfRxuTH8jolYAllk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=fTo9IO2q; arc=none smtp.client-ip=185.70.40.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=3qu2niw75nb2xbjezbisjc3dce.protonmail; t=1710371398; x=1710630598; bh=rYZPrBzSjkyRIMR5GIwY/KAK6jPdoSu7grZu7ns8X4Q=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=fTo9IO2qtRKJE1X29fMuTUGTtSPKC1Y/lyivka8OWJABM8Bpd764HMOCR/vxeW14V zRJkNTTeUe7eHXqgM5qKGYS8Uhm/UbJbRFPOa6CbeBdO0ATMw2WB+UtCiDBTp8e8YH 0m05TS0wYo+qGfDNZXJM1Ic0RKKgmJszbR4TXGMqiSZ3uYrAXU/y839sKjLmDMZrbG 64VvCO3nt9XSKT3ZRLQvua04GOU8o+G59eGJ46X3azCa5xo3rPTKnNjww8WzpUqFXe 54UOdOd/L2el/nKQuZ96+hDYefQj+UIJEDJgICx2rEvmccewi0z3ks832LpCQmb/Cl ZryR0wOx3uSqQ== Date: Wed, 13 Mar 2024 23:09:37 +0000 To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Martin Rodriguez Reboredo From: Benno Lossin Cc: Laine Taffin Altman , stable@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rust: init: remove impl Zeroable for Infallible Message-ID: <20240313230713.987124-1-benno.lossin@proton.me> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Laine Taffin Altman It is not enough for a type to be a ZST to guarantee that zeroed memory is a valid value for it; it must also be inhabited. Creating a value of an uninhabited type, ZST or no, is immediate UB. Thus remove the implementation of `Zeroable` for `Infallible`, since that type is not inhabited. Cc: stable@vger.kernel.org Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed` f= unction") Closes: https://github.com/Rust-for-Linux/pinned-init/pull/13 Signed-off-by: Laine Taffin Altman Signed-off-by: Benno Lossin --- rust/kernel/init.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 424257284d16..538e03cfc84a 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -1292,8 +1292,8 @@ macro_rules! impl_zeroable { i8, i16, i32, i64, i128, isize, f32, f64, =20 - // SAFETY: These are ZSTs, there is nothing to zero. - {} PhantomData, core::marker::PhantomPinned, Infallible,= (), + // SAFETY: These are inhabited ZSTs, there is nothing to zero and a va= lid value exists. + {} PhantomData, core::marker::PhantomPinned, (), =20 // SAFETY: Type is allowed to take any value, including all zeros. {} MaybeUninit, base-commit: 768409cff6cc89fe1194da880537a09857b6e4db --=20 2.42.0