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,11 +87,13 @@ pub fn kzmalloc(sz: usize) -> *mut u8 {
|
||||
let size = align_val(sz, 3);
|
||||
let ret = kmalloc(size);
|
||||
|
||||
if !ret.is_null() {
|
||||
for i in 0..size {
|
||||
unsafe {
|
||||
(*ret.add(i)) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user