Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions kernel/patch/common/supercall.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ static long call_kpm_nums()
static long call_kpm_list(char *__user names, int len)
{
if (len <= 0) return -EINVAL;
char buf[4096];
char buf[4096] = { 0 };
int sz = list_modules(buf, sizeof(buf));
if (sz < 0) return sz;
if (sz > len) return -ENOBUFS;
sz = compat_copy_to_user(names, buf, len);
return sz;
int copy_len = sz > 0 ? sz : 1;
int rc = compat_copy_to_user(names, buf, copy_len);
return rc == copy_len ? sz : -EFAULT;
}

static long call_kpm_info(const char *__user uname, char *__user out_info, int out_len)
Expand Down
3 changes: 3 additions & 0 deletions kernel/patch/module/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ int get_module_nums()

int list_modules(char *out_names, int size)
{
if (!out_names || size <= 0) return -EINVAL;
out_names[0] = '\0';

rcu_read_lock();

struct module *pos;
Expand Down