mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 02:16:19 +04:00
Add sanity check from kmalloc. Don't zero if it is null
This commit is contained in:
parent
a110d17355
commit
450a152b24
@ -87,9 +87,11 @@ pub fn kzmalloc(sz: usize) -> *mut u8 {
|
|||||||
let size = align_val(sz, 3);
|
let size = align_val(sz, 3);
|
||||||
let ret = kmalloc(size);
|
let ret = kmalloc(size);
|
||||||
|
|
||||||
for i in 0..size {
|
if !ret.is_null() {
|
||||||
unsafe {
|
for i in 0..size {
|
||||||
(*ret.add(i)) = 0;
|
unsafe {
|
||||||
|
(*ret.add(i)) = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user