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,13 +336,15 @@ 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 (copy_to_user(arg3, &profile, sizeof(profile))) { if (success) {
pr_err("copy profile failed\n"); if (copy_to_user(arg3, &profile, sizeof(profile))) {
return 0; pr_err("copy profile failed\n");
} return 0;
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) { }
pr_err("prctl reply error, cmd: %d\n", arg2); if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n", arg2);
}
} }
return 0; return 0;
} }