From: sashiko-bot@kernel.org
To: "Andreas Hindborg" <a.hindborg@kernel.org>
Cc: linux-pci@vger.kernel.org, ojeda@kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v19 3/8] rust: implement `ForeignOwnable` for `Owned`
Date: Fri, 26 Jun 2026 12:07:08 +0000 [thread overview]
Message-ID: <20260626120709.A8DAB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626-unique-ref-v19-3-2607ca88dfdf@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Use of `kernel::` instead of `crate::` for intra-crate imports and paths.
--
commit 5d83778cf519ec33130e7eef0e627d3e0a92700a
Author: Andreas Hindborg <a.hindborg@kernel.org>
rust: implement ForeignOwnable for Owned
This commit implements ForeignOwnable for Owned<T>, which allows it to be
used in places such as the XArray.
> diff --git a/rust/kernel/owned.rs b/rust/kernel/owned.rs
> index 7fe9ec3e55126..93a5dfcc1e6f5 100644
> --- a/rust/kernel/owned.rs
> +++ b/rust/kernel/owned.rs
> @@ -15,6 +15,8 @@
> ptr::NonNull, //
> };
>
> +use kernel::types::ForeignOwnable;
[Severity: Low]
This isn't a bug, but should this import use crate::types::ForeignOwnable
instead of kernel::types::ForeignOwnable for an intra-crate reference?
[ ... ]
> + #[inline]
> + fn into_foreign(self) -> *mut kernel::ffi::c_void {
[Severity: Low]
This is also a minor style detail, but is there a reason to use kernel::
instead of crate:: for the c_void path here?
Would it be better to use crate::ffi::c_void for the return type, as well
as for the ptr arguments in from_foreign(), borrow(), and borrow_mut() below?
> + Owned::into_raw(self).as_ptr().cast()
> + }
> +
> + #[inline]
> + unsafe fn from_foreign(ptr: *mut kernel::ffi::c_void) -> Self {
> + // SAFETY: By function safety contract, `ptr` came from `into_foreign` and cannot be null.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626-unique-ref-v19-0-2607ca88dfdf@kernel.org?part=3
next prev parent reply other threads:[~2026-06-26 12:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 11:53 [PATCH v19 0/8] rust: add `Ownable` trait and `Owned` type Andreas Hindborg
2026-06-26 11:53 ` [PATCH v19 1/8] rust: alloc: add `KBox::into_non_null` Andreas Hindborg
2026-06-26 12:01 ` sashiko-bot
2026-06-26 11:53 ` [PATCH v19 2/8] rust: types: Add Ownable/Owned types Andreas Hindborg
2026-06-26 12:06 ` sashiko-bot
2026-06-26 11:54 ` [PATCH v19 3/8] rust: implement `ForeignOwnable` for `Owned` Andreas Hindborg
2026-06-26 12:07 ` sashiko-bot [this message]
2026-06-26 11:54 ` [PATCH v19 4/8] rust: page: convert to `Ownable` Andreas Hindborg
2026-06-26 12:05 ` sashiko-bot
2026-06-26 11:54 ` [PATCH v19 5/8] rust: rename `AlwaysRefCounted` to `RefCounted` Andreas Hindborg
2026-06-26 12:06 ` sashiko-bot
2026-06-26 11:54 ` [PATCH v19 6/8] rust: Add missing SAFETY documentation for `ARef` example Andreas Hindborg
2026-06-26 12:02 ` sashiko-bot
2026-06-26 11:54 ` [PATCH v19 7/8] rust: Add `OwnableRefCounted` Andreas Hindborg
2026-06-26 12:06 ` sashiko-bot
2026-06-26 11:54 ` [PATCH v19 8/8] rust: page: add `from_raw()` Andreas Hindborg
2026-06-26 12:06 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260626120709.A8DAB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox