diff mbox series

fixdep: fix CONFIG_IS_ENABLED etc. handling

Message ID 20200708214556.90235-1-swarren@wwwdotorg.org
State Accepted
Commit 76ae74d348a05c8c9deb718368a69ba05afd9784
Delegated to: Tom Rini
Headers show
Series fixdep: fix CONFIG_IS_ENABLED etc. handling | expand

Commit Message

Stephen Warren July 8, 2020, 9:45 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

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")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 scripts/basic/fixdep.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Glass July 8, 2020, 10:24 p.m. UTC | #1
On Wed, 8 Jul 2020 at 15:46, Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> From: Stephen Warren <swarren@nvidia.com>
>
> 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")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  scripts/basic/fixdep.c | 1 +
>  1 file changed, 1 insertion(+)

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

Reviewed-by: Simon Glass <sjg@chromium.org>

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.
Tom Rini July 17, 2020, 8:58 p.m. UTC | #2
On Wed, Jul 08, 2020 at 03:45:56PM -0600, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> 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")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
Masahiro Yamada July 18, 2020, 3:37 a.m. UTC | #3
On Thu, Jul 9, 2020 at 6:53 AM Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> From: Stephen Warren <swarren@nvidia.com>
>
> 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")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  scripts/basic/fixdep.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
> index 24be244d5e6a..958668df5546 100644
> --- a/scripts/basic/fixdep.c
> +++ b/scripts/basic/fixdep.c
> @@ -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;
> --
> 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'.
diff mbox series

Patch

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 24be244d5e6a..958668df5546 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -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;