kernel: make compiler happy

This commit is contained in:
weishu
2023-10-21 22:43:58 +08:00
parent 84f16e4c82
commit 344c08bb79
3 changed files with 12 additions and 12 deletions

View File

@@ -289,7 +289,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (arg2 == CMD_GRANT_ROOT) { if (arg2 == CMD_GRANT_ROOT) {
if (is_allow_su()) { if (is_allow_su()) {
pr_info("allow root for: %d\n", current_uid()); pr_info("allow root for: %d\n", current_uid().val);
escape_to_root(); escape_to_root();
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) { if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("grant_root: prctl reply error\n"); pr_err("grant_root: prctl reply error\n");
@@ -303,7 +303,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (is_manager() || 0 == current_uid().val) { if (is_manager() || 0 == current_uid().val) {
u32 version = KERNEL_SU_VERSION; u32 version = KERNEL_SU_VERSION;
if (copy_to_user(arg3, &version, sizeof(version))) { if (copy_to_user(arg3, &version, sizeof(version))) {
pr_err("prctl reply error, cmd: %d\n", arg2); pr_err("prctl reply error, cmd: %lu\n", arg2);
} }
} }
return 0; return 0;
@@ -377,7 +377,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
sizeof(u32) * array_length)) { sizeof(u32) * array_length)) {
if (copy_to_user(result, &reply_ok, if (copy_to_user(result, &reply_ok,
sizeof(reply_ok))) { sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n", pr_err("prctl reply error, cmd: %lu\n",
arg2); arg2);
} }
} else { } else {
@@ -397,16 +397,16 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
} else if (arg2 == CMD_UID_SHOULD_UMOUNT) { } else if (arg2 == CMD_UID_SHOULD_UMOUNT) {
allow = ksu_uid_should_umount(target_uid); allow = ksu_uid_should_umount(target_uid);
} else { } else {
pr_err("unknown cmd: %d\n", arg2); pr_err("unknown cmd: %lu\n", arg2);
} }
if (!copy_to_user(arg4, &allow, sizeof(allow))) { if (!copy_to_user(arg4, &allow, sizeof(allow))) {
if (copy_to_user(result, &reply_ok, if (copy_to_user(result, &reply_ok,
sizeof(reply_ok))) { sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n", pr_err("prctl reply error, cmd: %lu\n",
arg2); arg2);
} }
} else { } else {
pr_err("prctl copy err, cmd: %d\n", arg2); pr_err("prctl copy err, cmd: %lu\n", arg2);
} }
} }
return 0; return 0;
@@ -433,7 +433,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0; return 0;
} }
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: %lu\n", arg2);
} }
} }
return 0; return 0;
@@ -449,7 +449,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
// todo: validate the params // todo: validate the params
if (ksu_set_app_profile(&profile, true)) { if (ksu_set_app_profile(&profile, true)) {
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: %lu\n", arg2);
} }
} }
return 0; return 0;

View File

@@ -340,17 +340,17 @@ int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
size_t rc_count = strlen(KERNEL_SU_RC); size_t rc_count = strlen(KERNEL_SU_RC);
pr_info("vfs_read: %s, comm: %s, count: %d, rc_count: %d\n", dpath, pr_info("vfs_read: %s, comm: %s, count: %zu, rc_count: %zu\n", dpath,
current->comm, count, rc_count); current->comm, count, rc_count);
if (count < rc_count) { if (count < rc_count) {
pr_err("count: %d < rc_count: %d\n", count, rc_count); pr_err("count: %zu < rc_count: %zu\n", count, rc_count);
return 0; return 0;
} }
size_t ret = copy_to_user(buf, KERNEL_SU_RC, rc_count); size_t ret = copy_to_user(buf, KERNEL_SU_RC, rc_count);
if (ret) { if (ret) {
pr_err("copy ksud.rc failed: %d\n", ret); pr_err("copy ksud.rc failed: %zu\n", ret);
return 0; return 0;
} }

View File

@@ -45,7 +45,7 @@ static void do_update_uid(struct work_struct *work)
ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0); ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
if (IS_ERR(fp)) { if (IS_ERR(fp)) {
pr_err("do_update_uid, open " SYSTEM_PACKAGES_LIST_PATH pr_err("do_update_uid, open " SYSTEM_PACKAGES_LIST_PATH
" failed: %d\n", " failed: %ld\n",
PTR_ERR(fp)); PTR_ERR(fp));
return; return;
} }