On Sun, Dec 28, 2008 at 1:38 PM, Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx> wrote: > 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) That is one piece of ugly code. > > 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? Do you have minimal code to duplicate this bug? I try with the following testing code without much luck. Chris typedef struct mmr_t mmr_t; struct mmr_t { int a; int mmr_fee_status; }; #define mmroff(p,f) (unsigned short)((void *)(&((mmr_t *)((void *)0 + (p)))->f) - (void *)0) int b; int foo(void) { return mmroff(0,mmr_fee_status); } -- 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