You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
kernel/module.c: use scnprintf() instead of sprintf()
For some strings, they are permitted to be larger than PAGE_SIZE, so need use scnprintf() instead of sprintf(), or it will cause issue. One case is: if a module version is crazy defined (length more than PAGE_SIZE), 'modinfo' command is still OK (print full contents), but for "cat /sys/modules/'modname'/version", will cause issue in kernel. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
+1
-1
@@ -604,7 +604,7 @@ static void setup_modinfo_##field(struct module *mod, const char *s) \
|
||||
static ssize_t show_modinfo_##field(struct module_attribute *mattr, \
|
||||
struct module_kobject *mk, char *buffer) \
|
||||
{ \
|
||||
return sprintf(buffer, "%s\n", mk->mod->field); \
|
||||
return scnprintf(buffer, PAGE_SIZE, "%s\n", mk->mod->field); \
|
||||
} \
|
||||
static int modinfo_##field##_exists(struct module *mod) \
|
||||
{ \
|
||||
|
||||
Reference in New Issue
Block a user