You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
kernel: ksud, throne_tracker: small changes for UL
Safe Ultra-Legacy changes that don't deserve their own commit
d_is_reg requires 4.0
- e36cb0b89c
IS_REG is still there on 6.15 so I do NOT see any issues forcing it for all.
strscpy requires 4.3
strscpy on this usage can be replaced with strncpy + null term.
kernel gives us an option though.
strlcpy is fast af, hotrod fast. It’s just memcpy + null term, so lets go with that.
it got dropped in 6.8 due to risk concerns, so for those, lets use og strscpy.
ref: openwrt/packages #26453
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
This commit is contained in:
@@ -338,7 +338,7 @@ int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d_is_reg(file->f_path.dentry)) {
|
if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,11 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
|
|||||||
return FILLDIR_ACTOR_CONTINUE;
|
return FILLDIR_ACTOR_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
|
||||||
|
strlcpy(data->dirpath, dirpath, DATA_PATH_LEN);
|
||||||
|
#else
|
||||||
strscpy(data->dirpath, dirpath, DATA_PATH_LEN);
|
strscpy(data->dirpath, dirpath, DATA_PATH_LEN);
|
||||||
|
#endif
|
||||||
data->depth = my_ctx->depth - 1;
|
data->depth = my_ctx->depth - 1;
|
||||||
list_add_tail(&data->list, my_ctx->data_path_list);
|
list_add_tail(&data->list, my_ctx->data_path_list);
|
||||||
} else {
|
} else {
|
||||||
@@ -230,7 +234,11 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
|
|||||||
|
|
||||||
// First depth
|
// First depth
|
||||||
struct data_path data;
|
struct data_path data;
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
|
||||||
|
strlcpy(data.dirpath, path, DATA_PATH_LEN);
|
||||||
|
#else
|
||||||
strscpy(data.dirpath, path, DATA_PATH_LEN);
|
strscpy(data.dirpath, path, DATA_PATH_LEN);
|
||||||
|
#endif
|
||||||
data.depth = depth;
|
data.depth = depth;
|
||||||
list_add_tail(&data.list, &data_path_list);
|
list_add_tail(&data.list, &data_path_list);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user