From 7a312ea52f7bac609b385b047095d08fd0f5d803 Mon Sep 17 00:00:00 2001 From: "viro@ZenIV.linux.org.uk" Date: Fri, 9 Sep 2005 18:29:38 +0100 Subject: [PATCH] [PATCH] Fix address space ordering problem We used to get "__user void *" wrong - it ended up with address space 0 instead of address space 1. What happens is actually pretty simple - we get address_space(1) handled in declaration_specifiers(), which sets ctype->as to 1. Then we see "void" and eventually get to ctype->base_type = type; } check_modifiers(&token->pos, s, ctype->modifiers); apply_ctype(token->pos, &thistype, ctype); with thistype coming from lookup for "void". And that, of course, has zero ->as. Now apply_ctype merrily buggers ctype->as and we have 0... So AFAICS proper fix for sparse should be to check thistype->as to see if it really has any intention to change ->as. Signed-off-by: Linus Torvalds --- parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index 425f7914..a1fedac1 100644 --- a/parse.c +++ b/parse.c @@ -636,7 +636,8 @@ static void apply_ctype(struct position pos, struct ctype *thistype, struct ctyp ctype->alignment = thistype->alignment; /* Address space */ - ctype->as = thistype->as; + if (thistype->as) + ctype->as = thistype->as; } static void check_modifiers(struct position *pos, struct symbol *s, unsigned long mod) -- 2.11.4.GIT