kernel: Adapt to old GCC

Co-Authored-By: backslashxx <118538522+backslashxx@users.noreply.github.com>
This commit is contained in:
Trijal Saha
2025-05-07 17:18:25 -04:00
committed by Rifat Azad
parent b368127aff
commit aa32835ff6
3 changed files with 14 additions and 14 deletions

View File

@@ -362,7 +362,7 @@ void do_save_allow_list(struct work_struct *work)
struct file *fp =
ksu_filp_open_compat(KERNEL_SU_ALLOWLIST, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (IS_ERR(fp)) {
pr_err("save_allow_list create file failed: %ld\n", PTR_ERR(fp));
pr_err("save_allow_list create file failed: %d\n", (int)PTR_ERR(fp));
return;
}
@@ -409,7 +409,7 @@ void do_load_allow_list(struct work_struct *work)
// load allowlist now!
fp = ksu_filp_open_compat(KERNEL_SU_ALLOWLIST, O_RDONLY, 0);
if (IS_ERR(fp)) {
pr_err("load_allow_list open file failed: %ld\n", PTR_ERR(fp));
pr_err("load_allow_list open file failed: %d\n", (int)PTR_ERR(fp));
return;
}

View File

@@ -371,7 +371,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
// Both root manager and root processes should be allowed to get version
if (arg2 == CMD_GET_VERSION) {
u32 version = KERNEL_SU_VERSION;
if (copy_to_user(arg3, &version, sizeof(version))) {
if (copy_to_user((void __user *)arg3, &version, sizeof(version))) {
pr_err("prctl reply error, cmd: %lu\n", arg2);
}
u32 version_flags = 0;
@@ -379,7 +379,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
version_flags |= 0x1;
#endif
if (arg4 &&
copy_to_user(arg4, &version_flags, sizeof(version_flags))) {
copy_to_user((void __user *)arg4, &version_flags, sizeof(version_flags))) {
pr_err("prctl reply error, cmd: %lu\n", arg2);
}
return 0;
@@ -423,7 +423,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (!from_root) {
return 0;
}
if (!handle_sepolicy(arg3, arg4)) {
if (!handle_sepolicy(arg3, (void __user *)arg4)) {
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("sepolicy: prctl reply error\n");
}
@@ -448,9 +448,9 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
bool success = ksu_get_allow_list(array, &array_length,
arg2 == CMD_GET_ALLOW_LIST);
if (success) {
if (!copy_to_user(arg4, &array_length,
if (!copy_to_user((void __user *)arg4, &array_length,
sizeof(array_length)) &&
!copy_to_user(arg3, array,
!copy_to_user((void __user *)arg3, array,
sizeof(u32) * array_length)) {
if (copy_to_user(result, &reply_ok,
sizeof(reply_ok))) {
@@ -474,7 +474,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
} else {
pr_err("unknown cmd: %lu\n", arg2);
}
if (!copy_to_user(arg4, &allow, sizeof(allow))) {
if (!copy_to_user((void __user *)arg4, &allow, sizeof(allow))) {
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %lu\n", arg2);
}
@@ -492,14 +492,14 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
// we are already manager
if (arg2 == CMD_GET_APP_PROFILE) {
struct app_profile profile;
if (copy_from_user(&profile, arg3, sizeof(profile))) {
if (copy_from_user(&profile, (void __user *)arg3, sizeof(profile))) {
pr_err("copy profile failed\n");
return 0;
}
bool success = ksu_get_app_profile(&profile);
if (success) {
if (copy_to_user(arg3, &profile, sizeof(profile))) {
if (copy_to_user((void __user *)arg3, &profile, sizeof(profile))) {
pr_err("copy profile failed\n");
return 0;
}
@@ -512,7 +512,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
if (arg2 == CMD_SET_APP_PROFILE) {
struct app_profile profile;
if (copy_from_user(&profile, arg3, sizeof(profile))) {
if (copy_from_user(&profile, (void __user *)arg3, sizeof(profile))) {
pr_err("copy profile failed\n");
return 0;
}
@@ -527,7 +527,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
}
if (arg2 == CMD_IS_SU_ENABLED) {
if (copy_to_user(arg3, &ksu_su_compat_enabled,
if (copy_to_user((void __user *)arg3, &ksu_su_compat_enabled,
sizeof(ksu_su_compat_enabled))) {
pr_err("copy su compat failed\n");
return 0;

View File

@@ -299,8 +299,8 @@ void track_throne()
struct file *fp =
ksu_filp_open_compat(SYSTEM_PACKAGES_LIST_PATH, O_RDONLY, 0);
if (IS_ERR(fp)) {
pr_err("%s: open " SYSTEM_PACKAGES_LIST_PATH " failed: %ld\n",
__func__, PTR_ERR(fp));
pr_err("%s: open " SYSTEM_PACKAGES_LIST_PATH " failed: %d\n",
__func__, (int)PTR_ERR(fp));
return;
}