]> git.baikalelectronics.ru Git - kernel.git/commit
module: fix out-by-one error in kallsyms
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 25 Oct 2012 00:19:25 +0000 (10:49 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Oct 2012 03:26:37 +0000 (13:56 +1030)
commit867724abf7e485970700d8f9c09a6cd41b67de0b
tree68ad548001fb24c0e63e1758d368a746998feb05
parentd2fc6433fdb79074f94c5d05501164243832df10
module: fix out-by-one error in kallsyms

Masaki found and patched a kallsyms issue: the last symbol in a
module's symtab wasn't transferred.  This is because we manually copy
the zero'th entry (which is always empty) then copy the rest in a loop
starting at 1, though from src[0].  His fix was minimal, I prefer to
rewrite the loops in more standard form.

There are two loops: one to get the size, and one to copy.  Make these
identical: always count entry 0 and any defined symbol in an allocated
non-init section.

This bug exists since the following commit was introduced.
   module: reduce symbol table for loaded modules (v2)
   commit: 37276a72a207819057417906f53512516fd6e4af

LKML: http://lkml.org/lkml/2012/10/24/27
Reported-by: Masaki Kimura <masaki.kimura.kz@hitachi.com>
Cc: stable@kernel.org
kernel/module.c