From: Robert Obkircher <r.obkircher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH v1 proxmox 4/6] io: remove boxed::uninitialized because it is unsound
Date: Tue, 11 Aug 2026 17:02:03 +0200 [thread overview]
Message-ID: <20260811150237.527116-5-r.obkircher@proxmox.com> (raw)
In-Reply-To: <20260811150237.527116-1-r.obkircher@proxmox.com>
Using this function could result in miscompilations, and it was also
missing a null check. Remove it, since it appears to be unused.
Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
proxmox-io/src/boxed.rs | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/proxmox-io/src/boxed.rs b/proxmox-io/src/boxed.rs
index fb67bfd7..abd60a1f 100644
--- a/proxmox-io/src/boxed.rs
+++ b/proxmox-io/src/boxed.rs
@@ -1,15 +1,3 @@
-/// Uninitialized bytes, without `MaybeUninit`.
-///
-/// We're talking about bytes here, which we *allocate*. That is, we call a function, get a pointer
-/// to stuff, and can use it. It's not UB in that there's nothing undefined about what's going on
-/// here.
-pub fn uninitialized(len: usize) -> Box<[u8]> {
- unsafe {
- let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
- Box::from_raw(std::ptr::slice_from_raw_parts_mut(data, len))
- }
-}
-
/// Zero-initialized bytes, meant for large sizes to avoid busting the stack.
pub fn zeroed(len: usize) -> Box<[u8]> {
// vec! guarantees not to over-allocate, so shrink_to_fit inside into_boxed_slice does nothing
--
2.47.3
next prev parent reply other threads:[~2026-08-11 15:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 15:01 [PATCH v1 proxmox 0/6] uninitialized memory allocations fixes Robert Obkircher
2026-08-11 15:02 ` [PATCH v1 proxmox 1/6] uuid: avoid potential null dereference and memory leaks Robert Obkircher
2026-08-11 15:02 ` [PATCH v1 proxmox 2/6] io: request zeroed memory instead of manually clearing it Robert Obkircher
2026-08-11 15:02 ` [PATCH v1 proxmox 3/6] io: avoid potential null dereference and memory leak on error path Robert Obkircher
2026-08-11 15:02 ` Robert Obkircher [this message]
2026-08-11 15:02 ` [PATCH v1 proxmox 5/6] io: remove unused append_to_vec functions Robert Obkircher
2026-08-11 15:02 ` [PATCH v1 proxmox 6/6] io: remove unused ByteVecExt trait with grow_ and resize_uninitialized Robert Obkircher
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=20260811150237.527116-5-r.obkircher@proxmox.com \
--to=r.obkircher@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/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