kernel: don't copy profile when not found

This commit is contained in:
weishu
2023-06-03 17:26:00 +08:00
parent 66827ab7de
commit de72eedb46

View File

@@ -336,7 +336,8 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0; return 0;
} }
ksu_get_app_profile(&profile); bool success = ksu_get_app_profile(&profile);
if (success) {
if (copy_to_user(arg3, &profile, sizeof(profile))) { if (copy_to_user(arg3, &profile, sizeof(profile))) {
pr_err("copy profile failed\n"); pr_err("copy profile failed\n");
return 0; return 0;
@@ -344,6 +345,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) { if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n", arg2); pr_err("prctl reply error, cmd: %d\n", arg2);
} }
}
return 0; return 0;
} }