Commit aed9373
rust: pin-init: internal: init: document load-bearing fact of field accessors
[ Upstream commit 580cc37 ]
The functions `[Pin]Init::__[pinned_]init` and `ptr::write` called from
the `init!` macro require the passed pointer to be aligned. This fact is
ensured by the creation of field accessors to previously initialized
fields.
Since we missed this very important fact from the beginning [1],
document it in the code.
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/561532-pin-init/topic/initialized.20field.20accessor.20detection/with/576210658 [1]
Fixes: 90e53c5 ("rust: add pin-init API core")
Cc: <stable@vger.kernel.org> # 6.6.y, 6.12.y: 42415d1: rust: pin-init: add references to previously initialized fields
Cc: <stable@vger.kernel.org> # 6.6.y, 6.12.y, 6.18.y, 6.19.y
Signed-off-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260302140424.4097655-2-lossin@kernel.org
[ Updated Cc: stable@ tags as discussed. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
[ Moved changes to the declarative macro, because 6.19.y and earlier do not
have `syn`. Also duplicated the comment for all field accessor creations.
- Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 1b247cd commit aed9373
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
1315 | 1319 | | |
1316 | 1320 | | |
1317 | 1321 | | |
| |||
1351 | 1355 | | |
1352 | 1356 | | |
1353 | 1357 | | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1354 | 1362 | | |
1355 | 1363 | | |
1356 | 1364 | | |
| |||
1391 | 1399 | | |
1392 | 1400 | | |
1393 | 1401 | | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1394 | 1406 | | |
1395 | 1407 | | |
1396 | 1408 | | |
| |||
1431 | 1443 | | |
1432 | 1444 | | |
1433 | 1445 | | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1434 | 1450 | | |
1435 | 1451 | | |
1436 | 1452 | | |
| |||
0 commit comments