* [PATCH] rust: configfs: fix release safety documentation
@ 2026-07-07 16:00 ` Yilin Chen
2026-07-08 6:44 ` Andreas Hindborg
2026-07-08 7:21 ` [PATCH v2] " Yilin Chen
0 siblings, 2 replies; 6+ messages in thread
From: Yilin Chen @ 2026-07-07 16:00 UTC (permalink / raw)
To: Andreas Hindborg, Breno Leitao, rust-for-linux
Cc: Miguel Ojeda, linux-kernel, Yilin Chen
The old Safety docs of ItemOperationsVTable<Group<Data>, Data>::release()
described this as a config_group pointer embedded in Group<Parent>.
But the inner code implies the implementation first gets the containing
config_group pointer through the cg_item field. It then gets Group<Data>
pointer from that group pointer.
The new Safety docs fix this by describing the actual pointer chain and
concrete Group<Data> type, not Group<Parent>.
Assisted-by: Codex:GPT-5
Signed-off-by: Yilin Chen <1479826151@qq.com>
---
rust/kernel/configfs.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
index 2339c6467..2ac75c628 100644
--- a/rust/kernel/configfs.rs
+++ b/rust/kernel/configfs.rs
@@ -437,8 +437,10 @@ impl<Data> ItemOperationsVTable<Group<Data>, Data>
{
/// # Safety
///
- /// `this` must be a pointer to a `bindings::config_group` embedded in a
- /// `Group<Parent>`.
+ /// `this` must be a valid pointer to the `bindings::config_item` embedded in
+ /// the `cg_item` field of a `bindings::config_group`.
+ ///
+ /// That `bindings::config_group` must be embedded in a `Group<Data>`.
///
/// This function will destroy the pointee of `this`. The pointee of `this`
/// must not be accessed after the function returns.
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust: configfs: fix release safety documentation
2026-07-07 16:00 ` [PATCH] rust: configfs: fix release safety documentation Yilin Chen
@ 2026-07-08 6:44 ` Andreas Hindborg
2026-07-08 7:21 ` [PATCH v2] " Yilin Chen
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Hindborg @ 2026-07-08 6:44 UTC (permalink / raw)
To: Yilin Chen, Breno Leitao, rust-for-linux
Cc: Miguel Ojeda, linux-kernel, Yilin Chen
"Yilin Chen" <1479826151@qq.com> writes:
> The old Safety docs of ItemOperationsVTable<Group<Data>, Data>::release()
> described this as a config_group pointer embedded in Group<Parent>.
>
> But the inner code implies the implementation first gets the containing
> config_group pointer through the cg_item field. It then gets Group<Data>
> pointer from that group pointer.
>
> The new Safety docs fix this by describing the actual pointer chain and
> concrete Group<Data> type, not Group<Parent>.
>
> Assisted-by: Codex:GPT-5
> Signed-off-by: Yilin Chen <1479826151@qq.com>
> ---
> rust/kernel/configfs.rs | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
> index 2339c6467..2ac75c628 100644
> --- a/rust/kernel/configfs.rs
> +++ b/rust/kernel/configfs.rs
> @@ -437,8 +437,10 @@ impl<Data> ItemOperationsVTable<Group<Data>, Data>
> {
> /// # Safety
> ///
> - /// `this` must be a pointer to a `bindings::config_group` embedded in a
> - /// `Group<Parent>`.
> + /// `this` must be a valid pointer to the `bindings::config_item` embedded in
> + /// the `cg_item` field of a `bindings::config_group`.
> + ///
> + /// That `bindings::config_group` must be embedded in a `Group<Data>`.
> ///
> /// This function will destroy the pointee of `this`. The pointee of `this`
> /// must not be accessed after the function returns.
I think it should also be `Group<Data>` instead of `Group<Parent>`.
How about:
`this` must be a pointer to the `cg_item` field of a
`bindings::config_group` embedded in a valid `Group<Data>`.
Best regards,
Andreas Hindborg
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] rust: configfs: fix release safety documentation
2026-07-07 16:00 ` [PATCH] rust: configfs: fix release safety documentation Yilin Chen
2026-07-08 6:44 ` Andreas Hindborg
@ 2026-07-08 7:21 ` Yilin Chen
2026-08-05 10:46 ` Andreas Hindborg
2026-09-29 10:21 ` Andreas Hindborg
1 sibling, 2 replies; 6+ messages in thread
From: Yilin Chen @ 2026-07-08 7:21 UTC (permalink / raw)
To: Andreas Hindborg, Breno Leitao, rust-for-linux
Cc: Miguel Ojeda, linux-kernel, Yilin Chen
ItemOperationsVTable<Group<Data>, Data>::release() receives a pointer
to a config_item, not a config_group.
The old Safety docs described the pointer as a config_group embedded in
Group<Parent>. Update them to state that the pointer must be the cg_item
field of a config_group embedded in a valid Group<Data>.
Assisted-by: Codex:GPT-5
Signed-off-by: Yilin Chen <1479826151@qq.com>
---
Changes in v2:
- Use the wording suggested in review: describe `this` as the `cg_item`
field of a `bindings::config_group` embedded in a valid `Group<Data>`.
rust/kernel/configfs.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
index 2339c6467..b626eb7dc 100644
--- a/rust/kernel/configfs.rs
+++ b/rust/kernel/configfs.rs
@@ -437,8 +437,8 @@ impl<Data> ItemOperationsVTable<Group<Data>, Data>
{
/// # Safety
///
- /// `this` must be a pointer to a `bindings::config_group` embedded in a
- /// `Group<Parent>`.
+ /// `this` must be a pointer to the `cg_item` field of a `bindings::config_group` embedded in a
+ /// valid `Group<Data>`.
///
/// This function will destroy the pointee of `this`. The pointee of `this`
/// must not be accessed after the function returns.
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] rust: configfs: fix release safety documentation
2026-07-08 7:21 ` [PATCH v2] " Yilin Chen
@ 2026-08-05 10:46 ` Andreas Hindborg
2026-08-05 12:43 ` Andreas Hindborg
2026-09-29 10:21 ` Andreas Hindborg
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Hindborg @ 2026-08-05 10:46 UTC (permalink / raw)
To: Yilin Chen, Breno Leitao, rust-for-linux
Cc: Miguel Ojeda, linux-kernel, Yilin Chen
Yilin Chen <1479826151@qq.com> writes:
> ItemOperationsVTable<Group<Data>, Data>::release() receives a pointer
> to a config_item, not a config_group.
>
> The old Safety docs described the pointer as a config_group embedded in
> Group<Parent>. Update them to state that the pointer must be the cg_item
> field of a config_group embedded in a valid Group<Data>.
>
> Assisted-by: Codex:GPT-5
> Signed-off-by: Yilin Chen <1479826151@qq.com>
Due to vacation activity, I missed v6.3 for this one. I plan on queuing
it for v6.4.
Best regards,
Andreas Hindborg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] rust: configfs: fix release safety documentation
2026-08-05 10:46 ` Andreas Hindborg
@ 2026-08-05 12:43 ` Andreas Hindborg
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Hindborg @ 2026-08-05 12:43 UTC (permalink / raw)
To: Yilin Chen, Breno Leitao, rust-for-linux
Cc: Miguel Ojeda, linux-kernel, Yilin Chen
Andreas Hindborg <a.hindborg@kernel.org> writes:
> Yilin Chen <1479826151@qq.com> writes:
>
>> ItemOperationsVTable<Group<Data>, Data>::release() receives a pointer
>> to a config_item, not a config_group.
>>
>> The old Safety docs described the pointer as a config_group embedded in
>> Group<Parent>. Update them to state that the pointer must be the cg_item
>> field of a config_group embedded in a valid Group<Data>.
>>
>> Assisted-by: Codex:GPT-5
>> Signed-off-by: Yilin Chen <1479826151@qq.com>
>
> Due to vacation activity, I missed v6.3 for this one. I plan on queuing
> it for v6.4.
v7.4 of course.
Best regards,
Andreas Hindborg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] rust: configfs: fix release safety documentation
2026-07-08 7:21 ` [PATCH v2] " Yilin Chen
2026-08-05 10:46 ` Andreas Hindborg
@ 2026-09-29 10:21 ` Andreas Hindborg
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Hindborg @ 2026-09-29 10:21 UTC (permalink / raw)
To: Breno Leitao, rust-for-linux, Yilin Chen; +Cc: Miguel Ojeda, linux-kernel
On Wed, 08 Jul 2026 07:21:06 +0000, Yilin Chen wrote:
> ItemOperationsVTable<Group<Data>, Data>::release() receives a pointer
> to a config_item, not a config_group.
>
> The old Safety docs described the pointer as a config_group embedded in
> Group<Parent>. Update them to state that the pointer must be the cg_item
> field of a config_group embedded in a valid Group<Data>.
>
> [...]
Applied, thanks!
[1/1] rust: configfs: fix release safety documentation
commit: 17ca0bc06bb246d9488556f3f16ad6f37a4fc5ad
Best regards,
--
Andreas Hindborg <a.hindborg@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-29 10:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <MYhFFRyD6omXiyidE9Yx2_JbeF2ia3Y4dj4f4JkGdpRLNV6QDhXo0fqvH2pGd2L47vNQBemdYDSWrjCxJDBJxA==@protonmail.internalid>
2026-07-07 16:00 ` [PATCH] rust: configfs: fix release safety documentation Yilin Chen
2026-07-08 6:44 ` Andreas Hindborg
2026-07-08 7:21 ` [PATCH v2] " Yilin Chen
2026-08-05 10:46 ` Andreas Hindborg
2026-08-05 12:43 ` Andreas Hindborg
2026-09-29 10:21 ` Andreas Hindborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®