* [PATCH 0/2] alpha-module: Adjustments for module_frob_arch_sections()
@ 2017-05-11 11:53 SF Markus Elfring
2017-05-11 11:54 ` [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections() SF Markus Elfring
2017-05-11 11:55 ` [PATCH 2/2] alpha-module: Delete an error message for a failed memory allocation " SF Markus Elfring
0 siblings, 2 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-11 11:53 UTC (permalink / raw)
To: linux-alpha, Ivan Kokshaysky, Matt Turner, Richard Henderson
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 13:11:23 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Improve a size determination
Delete an error message for a failed memory allocation
arch/alpha/kernel/module.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections()
2017-05-11 11:53 [PATCH 0/2] alpha-module: Adjustments for module_frob_arch_sections() SF Markus Elfring
@ 2017-05-11 11:54 ` SF Markus Elfring
2017-05-12 5:04 ` Al Viro
2017-05-11 11:55 ` [PATCH 2/2] alpha-module: Delete an error message for a failed memory allocation " SF Markus Elfring
1 sibling, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-11 11:54 UTC (permalink / raw)
To: linux-alpha, Ivan Kokshaysky, Matt Turner, Richard Henderson
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 12:54:29 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/alpha/kernel/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index 936bc8f89a67..387d9c500e48 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -105,5 +105,5 @@ module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,
}
nsyms = symtab->sh_size / sizeof(Elf64_Sym);
- chains = kcalloc(nsyms, sizeof(struct got_entry), GFP_KERNEL);
+ chains = kcalloc(nsyms, sizeof(*chains), GFP_KERNEL);
if (!chains) {
--
2.12.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] alpha-module: Delete an error message for a failed memory allocation in module_frob_arch_sections()
2017-05-11 11:53 [PATCH 0/2] alpha-module: Adjustments for module_frob_arch_sections() SF Markus Elfring
2017-05-11 11:54 ` [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections() SF Markus Elfring
@ 2017-05-11 11:55 ` SF Markus Elfring
1 sibling, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-11 11:55 UTC (permalink / raw)
To: linux-alpha, Ivan Kokshaysky, Matt Turner, Richard Henderson
Cc: LKML, kernel-janitors, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 13:00:34 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/alpha/kernel/module.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index 387d9c500e48..211e62e9a0af 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -109,9 +109,5 @@ module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,
- if (!chains) {
- printk(KERN_ERR
- "module %s: no memory for symbol chain buffer\n",
- me->name);
+ if (!chains)
return -ENOMEM;
- }
got->sh_size = 0;
got->sh_addralign = 8;
--
2.12.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections()
2017-05-11 11:54 ` [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections() SF Markus Elfring
@ 2017-05-12 5:04 ` Al Viro
0 siblings, 0 replies; 4+ messages in thread
From: Al Viro @ 2017-05-12 5:04 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-alpha, Ivan Kokshaysky, Matt Turner, Richard Henderson,
LKML, kernel-janitors
On Thu, May 11, 2017 at 01:54:42PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 11 May 2017 12:54:29 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
It's also making it harder to grep for. For the record: any patches of
that sort in VFS will be dropped. Preferably - on their author's toes,
after forcing said author to engrave them on bricks. Ideally - lead ones...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-12 5:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 11:53 [PATCH 0/2] alpha-module: Adjustments for module_frob_arch_sections() SF Markus Elfring
2017-05-11 11:54 ` [PATCH 1/2] alpha-module: Improve a size determination in module_frob_arch_sections() SF Markus Elfring
2017-05-12 5:04 ` Al Viro
2017-05-11 11:55 ` [PATCH 2/2] alpha-module: Delete an error message for a failed memory allocation " SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).