Skip to content

Commit

Permalink
kernel: make compiler happy
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Oct 21, 2023
1 parent 84f16e4 commit 344c08b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,

if (arg2 == CMD_GRANT_ROOT) {
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();
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("grant_root: prctl reply error\n");
Expand All @@ -303,7 +303,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (is_manager() || 0 == current_uid().val) {
u32 version = KERNEL_SU_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;
Expand Down Expand Up @@ -377,7 +377,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
sizeof(u32) * array_length)) {
if (copy_to_user(result, &reply_ok,
sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n",
pr_err("prctl reply error, cmd: %lu\n",
arg2);
}
} else {
Expand All @@ -397,16 +397,16 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
} else if (arg2 == CMD_UID_SHOULD_UMOUNT) {
allow = ksu_uid_should_umount(target_uid);
} 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(result, &reply_ok,
sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n",
pr_err("prctl reply error, cmd: %lu\n",
arg2);
}
} else {
pr_err("prctl copy err, cmd: %d\n", arg2);
pr_err("prctl copy err, cmd: %lu\n", arg2);
}
}
return 0;
Expand All @@ -433,7 +433,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0;
}
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;
Expand All @@ -449,7 +449,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
// todo: validate the params
if (ksu_set_app_profile(&profile, true)) {
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;
Expand Down
6 changes: 3 additions & 3 deletions kernel/ksud.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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);

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;
}

size_t ret = copy_to_user(buf, KERNEL_SU_RC, rc_count);
if (ret) {
pr_err("copy ksud.rc failed: %d\n", ret);
pr_err("copy ksud.rc failed: %zu\n", ret);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion kernel/uid_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void do_update_uid(struct work_struct *work)
ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
if (IS_ERR(fp)) {
pr_err("do_update_uid, open " SYSTEM_PACKAGES_LIST_PATH
" failed: %d\n",
" failed: %ld\n",
PTR_ERR(fp));
return;
}
Expand Down

0 comments on commit 344c08b

Please sign in to comment.