From: viro@ZenIV.linux.org.uk
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andreas Schwab <schwab@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [sparse fix] (was Re: [PATCH] bogus cast in bio.c)
Date: Fri, 9 Sep 2005 18:34:15 +0100 [thread overview]
Message-ID: <20050909173415.GS9623@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20050909172938.GQ9623@ZenIV.linux.org.uk>
On Fri, Sep 09, 2005 at 06:29:38PM +0100, viro@ZenIV.linux.org.uk wrote:
> > fs/bio.c:686:15: warning: incorrect type in assignment (different address spaces)
> > fs/bio.c:686:15: expected void [noderef] *iov_base<asn:1>
> > fs/bio.c:686:15: got void [noderef] *<noident>
> > from the first form (cast to __user void *). Lovely...
> >
> > OK, I think I know what's going on there, will fix.
>
> 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. ACK?
PS: obvious testcase for that one:
#define X __attribute__((address_space(1)))
void X *p;
void X *q;
void foo(unsigned long n)
{
p = (void X *)n;
q = (X void *)n;
}
next prev parent reply other threads:[~2005-09-09 17:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 15:53 [PATCH] bogus cast in bio.c viro
2005-09-09 16:18 ` Andreas Schwab
2005-09-09 16:36 ` viro
2005-09-09 17:29 ` [sparse fix] (was Re: [PATCH] bogus cast in bio.c) viro
2005-09-09 17:34 ` viro [this message]
2005-09-09 17:48 ` Linus Torvalds
2005-09-09 18:15 ` Linus Torvalds
2005-09-09 20:10 ` viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050909173415.GS9623@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=schwab@suse.de \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®