diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c index 64787cddeb5e..12afc5a3ddd3 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1037,7 +1037,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
1037 | 1037 | ||
1038 | /* Count loaded sections and allocate structures */ | 1038 | /* Count loaded sections and allocate structures */ |
1039 | for (i = 0; i < nsect; i++) | 1039 | for (i = 0; i < nsect; i++) |
1040 | if (sechdrs[i].sh_flags & SHF_ALLOC) | 1040 | if (sechdrs[i].sh_flags & SHF_ALLOC |
1041 | && sechdrs[i].sh_size) | ||
1041 | nloaded++; | 1042 | nloaded++; |
1042 | size[0] = ALIGN(sizeof(*sect_attrs) | 1043 | size[0] = ALIGN(sizeof(*sect_attrs) |
1043 | + nloaded * sizeof(sect_attrs->attrs[0]), | 1044 | + nloaded * sizeof(sect_attrs->attrs[0]), |
@@ -1057,6 +1058,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
1057 | for (i = 0; i < nsect; i++) { | 1058 | for (i = 0; i < nsect; i++) { |
1058 | if (! (sechdrs[i].sh_flags & SHF_ALLOC)) | 1059 | if (! (sechdrs[i].sh_flags & SHF_ALLOC)) |
1059 | continue; | 1060 | continue; |
1061 | if (!sechdrs[i].sh_size) | ||
1062 | continue; | ||
1060 | sattr->address = sechdrs[i].sh_addr; | 1063 | sattr->address = sechdrs[i].sh_addr; |
1061 | sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, | 1064 | sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, |
1062 | GFP_KERNEL); | 1065 | GFP_KERNEL); |