From mboxrd@z Thu Jan 1 00:00:00 1970 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 AD6851F941; Sat, 14 Jun 2025 18:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749927219; cv=none; b=MN4ACfzPJkBfNgi1R8/wIZvA3+N/AW2tZDtkjXmou+RXebJIBBP2pBOHlVGZSKom+El/dSlbseIbJ6H7PfSDddsHAPj0YvwRma2rnCdwpSRtDcuDk4mnYciKi7vPchFfudvFapdJzYKFuFoThZX38n4Aho1Xp1GzD5fLEh/If+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749927219; c=relaxed/simple; bh=vaspYYUdyipuilwzgjC/E308IR/28hvnXzZCjErcA3o=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=lK4/0bOef1celYgnJirN4GtkzayogloQKlpCAtMN6Fw2q2/n0XUZBA/YdFxbNIlcOTIPkyDUl2XBiqDOzabl3HN/7uicAuAUv4mj6XttBHA3wW6t1pCFHSB90bU/YpZy2iUp7bK8QPJ6sXeCGdKrpMvV1FsOgI6DIw+D/RrWyFY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fBCFT29I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fBCFT29I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3DCC4CEEB; Sat, 14 Jun 2025 18:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749927219; bh=vaspYYUdyipuilwzgjC/E308IR/28hvnXzZCjErcA3o=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=fBCFT29In6dOJhN/DyGpjDvLKzjrLuaLJ76P/0y8PrxpsZnf7jZAnAAFqtE+Vl2YB ssQVqtmIXvRryo6ziSgHRRTm8T0owQn/D+VG3PZcQTPWpmSJECxlDAGWwTKXsDrCX2 XAKn14xuXmqNS/XgZogFbefPf17OHV/nkhKSCq38+CfnJ4eFrgLFS1AbD+QdL8QPGa nbCJmhxv0r5JCt8eLpSQabPnIDOnuJudErVzOKr25wlXrAhMQFKjZrUG6v7XbGYA3O 1AadWRLc+QnYavOUw4SM8P2ovLpicaBx1sjugUzPu3RzwB8zGsz2G0G7qSnDXnXC9b YHP7U1YsEmQlA== Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 14 Jun 2025 20:53:34 +0200 Message-Id: Cc: "Danilo Krummrich" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Alice Ryhl" , "Trevor Gross" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Tamir Duberstein" , "Viresh Kumar" , , , Subject: Re: [PATCH v3 2/2] rust: types: require `ForeignOwnable::into_foreign` return non-null From: "Benno Lossin" To: "Andreas Hindborg" X-Mailer: aerc 0.20.1 References: <20250612-pointed-to-v3-0-b009006d86a1@kernel.org> <20250612-pointed-to-v3-2-b009006d86a1@kernel.org> <87sek3by5l.fsf@kernel.org> In-Reply-To: <87sek3by5l.fsf@kernel.org> On Fri Jun 13, 2025 at 2:53 PM CEST, Andreas Hindborg wrote: > "Benno Lossin" writes: > >> On Thu Jun 12, 2025 at 3:09 PM CEST, Andreas Hindborg wrote: >>> The intended implementations of `ForeignOwnable` will not return null >>> pointers from `into_foreign`, as this would render the implementation o= f >>> `try_from_foreign` useless. Current users of `ForeignOwnable` rely on >>> `into_foreign` returning non-null pointers. So require `into_foreign` t= o >>> return non-null pointers. >>> >>> Suggested-by: Benno Lossin >>> Suggested-by: Alice Ryhl >>> Signed-off-by: Andreas Hindborg >>> --- >>> rust/kernel/types.rs | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs >>> index c156808a78d3..63a2559a545f 100644 >>> --- a/rust/kernel/types.rs >>> +++ b/rust/kernel/types.rs >>> @@ -43,6 +43,7 @@ pub unsafe trait ForeignOwnable: Sized { >>> /// # Guarantees >>> /// >>> /// - Minimum alignment of returned pointer is [`Self::FOREIGN_ALI= GN`]. >>> + /// - The returned pointer is not null. >> >> This also needs to be mentioned in the `Safety` section of this trait. >> Alternatively you can put "Implementers must ensure the guarantees on >> [`into_foreign`] are upheld." or similar. > > Which is exactly what I did :) Ah didn't look at the first patch again, then it's fine :) Reviewed-by: Benno Lossin --- Cheers, Benno