Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1650207 > unrolled thread
| Started by | Wanlong Gao <gaowanlong@huawei.com> |
|---|---|
| First post | 2017-05-25 08:20 +0200 |
| Last post | 2017-05-27 12:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] modpost: abort if a module name is too long Wanlong Gao <gaowanlong@huawei.com> - 2017-05-25 08:20 +0200
Re: [PATCH] modpost: abort if a module name is too long Rusty Russell <rusty@rustcorp.com.au> - 2017-05-27 12:10 +0200
| From | Wanlong Gao <gaowanlong@huawei.com> |
|---|---|
| Date | 2017-05-25 08:20 +0200 |
| Subject | Re: [PATCH] modpost: abort if a module name is too long |
| Message-ID | <tKUhQ-4zw-9@gated-at.bofh.it> |
Folks,
Any comments?
On 2017/5/20 15:46, Xie XiuQi wrote:
> From: Wanlong Gao <gaowanlong@huawei.com>
>
> Module name has a limited length, but currently the build system
> allows the build finishing even if the module name is too long.
>
> CC /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.o
> /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.c:9:2:
> warning: initializer-string for array of chars is too long [enabled by default]
> .name = KBUILD_MODNAME,
> ^
>
> but it's merely a warning.
>
> This patch adds the check of the module name length in modpost and stops
> the build properly.
>
> Signed-off-by: Wanlong Gao <gaowanlong@huawei.com>
> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
> ---
> scripts/mod/modpost.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 30d752a..db11c57 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -2166,6 +2166,17 @@ static int add_versions(struct buffer *b, struct module *mod)
> {
> struct symbol *s, *exp;
> int err = 0;
> + const char *mod_name;
> +
> + mod_name = strrchr(mod->name, '/');
> + if (mod_name == NULL)
> + mod_name = mod->name;
> + else
> + mod_name++;
> + if (strlen(mod_name) >= MODULE_NAME_LEN) {
> + merror("module name is too long [%s.ko]\n", mod->name);
> + return 1;
> + }
>
> for (s = mod->unres; s; s = s->next) {
> exp = find_symbol(s->name);
>
[toc] | [next] | [standalone]
| From | Rusty Russell <rusty@rustcorp.com.au> |
|---|---|
| Date | 2017-05-27 12:10 +0200 |
| Message-ID | <tLGPv-1Om-11@gated-at.bofh.it> |
| In reply to | #1650207 |
Wanlong Gao <gaowanlong@huawei.com> writes:
> Folks,
>
> Any comments?
I've CC'd the module maintainer, who can help with this :_
Cheers,
Rusty.
> On 2017/5/20 15:46, Xie XiuQi wrote:
>> From: Wanlong Gao <gaowanlong@huawei.com>
>>
>> Module name has a limited length, but currently the build system
>> allows the build finishing even if the module name is too long.
>>
>> CC /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.o
>> /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.c:9:2:
>> warning: initializer-string for array of chars is too long [enabled by default]
>> .name = KBUILD_MODNAME,
>> ^
>>
>> but it's merely a warning.
>>
>> This patch adds the check of the module name length in modpost and stops
>> the build properly.
>>
>> Signed-off-by: Wanlong Gao <gaowanlong@huawei.com>
>> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
>> ---
>> scripts/mod/modpost.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
>> index 30d752a..db11c57 100644
>> --- a/scripts/mod/modpost.c
>> +++ b/scripts/mod/modpost.c
>> @@ -2166,6 +2166,17 @@ static int add_versions(struct buffer *b, struct module *mod)
>> {
>> struct symbol *s, *exp;
>> int err = 0;
>> + const char *mod_name;
>> +
>> + mod_name = strrchr(mod->name, '/');
>> + if (mod_name == NULL)
>> + mod_name = mod->name;
>> + else
>> + mod_name++;
>> + if (strlen(mod_name) >= MODULE_NAME_LEN) {
>> + merror("module name is too long [%s.ko]\n", mod->name);
>> + return 1;
>> + }
>>
>> for (s = mod->unres; s; s = s->next) {
>> exp = find_symbol(s->name);
>>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web