Alexander Lobakin b5beffa20d modpost: fix removing numeric suffixes
With the `-z unique-symbol` linker flag or any similar mechanism,
it is possible to trigger the following:

ERROR: modpost: "param_set_uint.0" [vmlinux] is a static EXPORT_SYMBOL

The reason is that for now the condition from remove_dot():

if (m && (s[n + m] == '.' || s[n + m] == 0))

which was designed to test if it's a dot or a '\0' after the suffix
is never satisfied.
This is due to that `s[n + m]` always points to the last digit of a
numeric suffix, not on the symbol next to it (from a custom debug
print added to modpost):

param_set_uint.0, s[n + m] is '0', s[n + m + 1] is '\0'

So it's off-by-one and was like that since 2014.

Fix this for the sake of any potential upcoming features, but don't
bother stable-backporting, as it's well hidden -- apart from that
LD flag, it can be triggered only with GCC LTO which never landed
upstream.

Fixes: fcd38ed0ff26 ("scripts: modpost: fix compilation warning")
Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-05-27 16:05:01 +09:00
..
2022-01-15 12:15:35 +01:00
2022-04-22 12:32:03 +02:00
2022-05-26 12:09:50 -07:00
2022-05-26 12:09:50 -07:00
2022-03-21 08:13:03 -07:00
2021-05-02 00:43:35 +09:00
2022-03-07 13:54:59 +01:00
2022-01-19 11:15:19 +02:00
2020-12-08 23:30:04 +09:00
2022-02-04 16:43:01 +01:00
2020-12-08 23:30:04 +09:00
2021-05-03 17:23:06 -06:00