Skip to content

Commit

Permalink
kernel: optimize uid list reading
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Dec 27, 2023
1 parent 26da7d5 commit fe7f509
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/uid_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void do_update_uid(struct work_struct *work)
char chr = 0;
loff_t pos = 0;
loff_t line_start = 0;
char buf[128];
char buf[KSU_MAX_PACKAGE_NAME];
for (;;) {
ssize_t count =
ksu_kernel_read_compat(fp, &chr, sizeof(chr), &pos);
Expand All @@ -69,7 +69,7 @@ static void do_update_uid(struct work_struct *work)
&line_start);

struct uid_data *data =
kmalloc(sizeof(struct uid_data), GFP_ATOMIC);
kzalloc(sizeof(struct uid_data), GFP_ATOMIC);
if (!data) {
goto out;
}
Expand All @@ -80,13 +80,13 @@ static void do_update_uid(struct work_struct *work)
char *uid = strsep(&tmp, delim);
if (!uid || !package) {
pr_err("update_uid: package or uid is NULL!\n");
continue;
break;
}

u32 res;
if (kstrtou32(uid, 10, &res)) {
pr_err("update_uid: uid parse err\n");
continue;
break;
}
data->uid = res;
strncpy(data->package, package, KSU_MAX_PACKAGE_NAME);
Expand Down

0 comments on commit fe7f509

Please sign in to comment.