Re: [PATCH] Null ctype should have ptr_ctype as its base type.

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

 



On Sun, Dec 28, 2008 at 23:52, Christopher Li <sparse@xxxxxxxxxxx> wrote:
> On Sun, Dec 28, 2008 at 7:14 AM, Alexey Zaytsev
> <alexey.zaytsev@xxxxxxxxx> wrote:
>
>> So, we are getting a sizeof(NULL), or a sizeof((void *)0). It triggers here
>
> That is my fault. My test for void type should have been more careful.
>
>> because we are getting a null_ctype, and it's base_type points to
>> void_ctype. I'm not sure if this patch is correct, but it seems to do
>> the trick, all void warnings are gone. Christopher?
>
> No, that is not the right way to fix it. Now you declare NULL as pointer
> to a pointer type "(void**) 0".
>
> Thanks for finding it out. Does my patch work for you?

Yes, it works, thank you.
There is one problem left:

11091a11093,11130
> drivers/net/wireless/wavelan_cs.c:362:16: error: subtraction of different types can't work (different base types)
> drivers/net/wireless/wavelan_cs.c:379:17: error: subtraction of different types can't work (different base types)
> drivers/net/wireless/wavelan_cs.c:385:21: error: subtraction of different types can't work (different base types)
[...]

It looks like:

... mmroff(0, mmr_fee_status) ..

#define mmroff(p,f)     (unsigned short)((void *)(&((mmr_t *)((void
*)0 + (p)))->f) - (void *)0)

mmr_fee_status being an element in struct mmr.
Here we end up substracting null from non-null void * pointer.
Looks quite pointless, but I think sparse should be able to
cope with this?
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux