Skip to contentSkip to conversation

fixdep: fix CONFIG_IS_ENABLED etc. handling

PATCH New Stephen Warren 4 participants 4 messages Jul 8, 2020 – Jul 18, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixdep: fix CONFIG_IS_ENABLED etc. handling

From: Stephen Warren <[email protected]>

When fixdep detects CONFIG_IS_ENABLED and other similar macros, it must parse the macro parameter to determine which actual CONFIG_ option is being referenced. This involves moving a pointer forward through the entire CONFIG_ option "word". Currently, the code uses variable q to walk through the word, but doesn't actually initialize it to point at the parameter before doing so. Consequently, the walking process immediately fails since it sees the macro invocatoins's ( rather than the expected alpha-numeric characters in the macro parameter. Fix this by adding the missing initialization.

Fixes 67f2ee86ccbe ("kbuild: fixdep: Resync this with v4.17")
Fixes 7012865e961c ("gpio: fix test.py for gpio label lookup")
---
 scripts/basic/fixdep.c | 1 +
 1 file changed, 1 insertion(+)
scripts/basic/fixdep.c +1 -0
index 24be244d5e6a..958668df5546 100644
@@ -266,6 +266,7 @@ static void parse_config_file(const char *p)
 		    (q - p == 9 && !memcmp(p, "IS_MODULE(", 10)) ||
 		    (q - p == 3 && !memcmp(p, "VAL(", 4))) {
 			p = q + 1;
+			q  = p;
 			while (isalnum(*q) || *q == '_')
 				q++;
 			r = q;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 fixdep: fix CONFIG_IS_ENABLED etc. handling

Quoted 13 lines · Stephen Warren

From: Stephen Warren <[email protected]>

When fixdep detects CONFIG_IS_ENABLED and other similar macros, it must parse the macro parameter to determine which actual CONFIG_ option is being referenced. This involves moving a pointer forward through the entire CONFIG_ option "word". Currently, the code uses variable q to walk through the word, but doesn't actually initialize it to point at the parameter before doing so. Consequently, the walking process immediately fails since it sees the macro invocatoins's ( rather than the expected alpha-numeric characters in the macro parameter. Fix this by adding the missing initialization.

Quoted 6 lines
Fixes 67f2ee86ccbe ("kbuild: fixdep: Resync this with v4.17")
Fixes 7012865e961c ("gpio: fix test.py for gpio label lookup")
---
 scripts/basic/fixdep.c | 1 +
 1 file changed, 1 insertion(+)

I'm really not sure how you found that needle.

Oddly enough I cannot repeat the problems I was having last week after a quick try, but this definitely looks like the culprit to me.

#2 lore raw

PATCH 1/1 fixdep: fix CONFIG_IS_ENABLED etc. handling

In reply to Stephen Warren
Quoted 12 lines · Stephen Warren

From: Stephen Warren <[email protected]>

When fixdep detects CONFIG_IS_ENABLED and other similar macros, it must parse the macro parameter to determine which actual CONFIG_ option is being referenced. This involves moving a pointer forward through the entire CONFIG_ option "word". Currently, the code uses variable q to walk through the word, but doesn't actually initialize it to point at the parameter before doing so. Consequently, the walking process immediately fails since it sees the macro invocatoins's ( rather than the expected alpha-numeric characters in the macro parameter. Fix this by adding the missing initialization.

Quoted 4 lines
Fixes 67f2ee86ccbe ("kbuild: fixdep: Resync this with v4.17")
Fixes 7012865e961c ("gpio: fix test.py for gpio label lookup")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200717/53e05dca/attachment.sig>
#3 lore raw

PATCH 1/1 fixdep: fix CONFIG_IS_ENABLED etc. handling

In reply to Stephen Warren
Quoted 33 lines · Stephen Warren

From: Stephen Warren <[email protected]>

When fixdep detects CONFIG_IS_ENABLED and other similar macros, it must parse the macro parameter to determine which actual CONFIG_ option is being referenced. This involves moving a pointer forward through the entire CONFIG_ option "word". Currently, the code uses variable q to walk through the word, but doesn't actually initialize it to point at the parameter before doing so. Consequently, the walking process immediately fails since it sees the macro invocatoins's ( rather than the expected alpha-numeric characters in the macro parameter. Fix this by adding the missing initialization.

Fixes 67f2ee86ccbe ("kbuild: fixdep: Resync this with v4.17")
Fixes 7012865e961c ("gpio: fix test.py for gpio label lookup")
---
 scripts/basic/fixdep.c | 1 +
 1 file changed, 1 insertion(+)
scripts/basic/fixdep.c +1 -1
index 24be244d5e6a..958668df5546 100644
@@ -266,6 +266,7 @@ static void parse_config_file(const char *p)
                    (q - p == 9 && !memcmp(p, "IS_MODULE(", 10)) ||
                    (q - p == 3 && !memcmp(p, "VAL(", 4))) {
                        p = q + 1;
+                       q  = p;
                        while (isalnum(*q) || *q == '_')
                                q++;
                        r = q;
--
Quoted 2 lines

2.25.1

Sorry, I missed this patch.
Yes, this fixes the bug. Thanks.

Just a nit about the coding style:
There are two spaces after 'q'.

Signature · 2 lines
Best Regards
Masahiro Yamada