kernel: Replace kmalloc() usages with kzalloc() (#2939)

This ensures we won't use uninitialized pointers for task work.
This commit is contained in:
Wang Han
2025-11-16 15:17:55 +08:00
committed by ShirkNeko
parent a4a9df3a25
commit 25fbc22f66
7 changed files with 13 additions and 12 deletions

View File

@@ -47,7 +47,7 @@ static void remove_uid_from_arr(uid_t uid)
if (allow_list_pointer == 0)
return;
temp_arr = kmalloc(sizeof(allow_list_arr), GFP_KERNEL);
temp_arr = kzalloc(sizeof(allow_list_arr), GFP_KERNEL);
if (temp_arr == NULL) {
pr_err("%s: unable to allocate memory\n", __func__);
return;
@@ -200,7 +200,7 @@ bool ksu_set_app_profile(struct app_profile *profile, bool persist)
}
// not found, alloc a new node!
p = (struct perm_data *)kmalloc(sizeof(struct perm_data), GFP_KERNEL);
p = (struct perm_data *)kzalloc(sizeof(struct perm_data), GFP_KERNEL);
if (!p) {
pr_err("ksu_set_app_profile alloc failed\n");
return false;