Re: [sparse fix] (was Re: [PATCH] bogus cast in bio.c)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 09, 2005 at 06:29:38PM +0100, [email protected] 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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux