1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-23 18:06:20 +04:00

Add sanity check from kmalloc. Don't zero if it is null

This commit is contained in:
Stephen Marz 2019-10-10 08:45:39 -04:00
parent a110d17355
commit 450a152b24

View File

@ -87,9 +87,11 @@ pub fn kzmalloc(sz: usize) -> *mut u8 {
let size = align_val(sz, 3);
let ret = kmalloc(size);
for i in 0..size {
unsafe {
(*ret.add(i)) = 0;
if !ret.is_null() {
for i in 0..size {
unsafe {
(*ret.add(i)) = 0;
}
}
}
ret