From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 38BA81FF150 for ; Wed, 12 Aug 2026 10:26:22 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id F03C92141B; Wed, 12 Aug 2026 10:26:20 +0200 (CEST) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH v2 proxmox 4/6] io: remove boxed::uninitialized because it is unsound Date: Wed, 12 Aug 2026 10:23:33 +0200 Message-ID: <20260812082549.21561-5-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260812082549.21561-1-r.obkircher@proxmox.com> References: <20260812082549.21561-1-r.obkircher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1786523161380 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.742 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: Z5LYWBU4CHWGIEHSYIQTDFXRNT57JD5Y X-Message-ID-Hash: Z5LYWBU4CHWGIEHSYIQTDFXRNT57JD5Y X-MailFrom: r.obkircher@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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::(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