Skip to content

Commit 9d04caa

Browse files
fix: a few warnings
Signed-off-by: Anhad Singh <[email protected]>
1 parent e045934 commit 9d04caa

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/aero_kernel/src/arch/x86_64/gdt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
//! * <https://wiki.osdev.org/Global_Descriptor_Table>
2626
2727
use core::alloc::Layout;
28-
use core::mem;
2928
use core::ptr::addr_of;
29+
use core::{mem, ptr};
3030

3131
use alloc::alloc::alloc_zeroed;
3232

@@ -271,7 +271,7 @@ impl GdtEntry {
271271

272272
fn set_raw<T>(&mut self, value: T) {
273273
unsafe {
274-
*(self as *mut _ as *mut T) = value;
274+
*(ptr::addr_of_mut!(*self).cast::<T>()) = value;
275275
}
276276
}
277277
}

src/aero_kernel/src/fs/ext2/group_desc.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with Aero. If not, see <https://www.gnu.org/licenses/>.
1717

18-
use core::mem::MaybeUninit;
19-
2018
use alloc::boxed::Box;
2119
use alloc::sync::{Arc, Weak};
2220

@@ -53,10 +51,7 @@ impl GroupDescriptors {
5351
let bgdt_len = superblock.bgdt_len();
5452
let mut bgdt = Box::<[disk::GroupDescriptor]>::new_uninit_slice(bgdt_len);
5553

56-
device.read(
57-
superblock.bgdt_block(),
58-
MaybeUninit::slice_as_bytes_mut(&mut bgdt),
59-
)?;
54+
device.read(superblock.bgdt_block(), bgdt.as_bytes_mut())?;
6055

6156
// SAFETY: We have initialized the BGD (Block Group Descriptor Table) above.
6257
let bgdt = unsafe { bgdt.assume_init() };

src/aero_kernel/src/fs/ext2/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl INodeInterface for INode {
557557
Ok(path.into())
558558
} else {
559559
let mut buffer = Box::<[u8]>::new_uninit_slice(path_len);
560-
self.read(0, MaybeUninit::slice_as_bytes_mut(&mut buffer))?;
560+
self.read(0, buffer.as_bytes_mut())?;
561561

562562
let path_bytes = unsafe { buffer.assume_init() };
563563
let path = core::str::from_utf8(&path_bytes).or(Err(FileSystemError::InvalidPath))?;

0 commit comments

Comments
 (0)