Re: [PATCH] kmemcheck: fix sparse warning

From: Johannes Berg
Date: Wed Jul 08 2009 - 15:40:33 EST


On Wed, 2009-07-08 at 21:28 +0200, Vegard Nossum wrote:

> > #define kmemcheck_annotate_bitfield(ptr, name) \
> > - do if (ptr) { \
> > + do { if (ptr) { \
> > int _n = (long) &((ptr)->name##_end) \
> > - (long) &((ptr)->name##_begin); \
> > BUILD_BUG_ON(_n < 0); \
> > \
> > kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
> > - } while (0)
> > + } } while (0)
> >
> > #define kmemcheck_annotate_variable(var) \
> > do { \
> >
> >
> >
>
> I'll change the patch title to "kmemcheck: work around bogus sparse
> warning" and fix the indentation, sounds ok?

Well, it's debatable whether it's bogus or not, but I don't care as long
as it gets fixed.

> Meanwhile, I Cced sparse mailing list in case somebody else knows
> anything else about this warning (what it means, whether it's
> justified in this case, whether it should be fixed in sparse, etc.).

Everybody take me off the CC please then :) This has been discussed far
too many times already. In this special case, the warning probably isn't
all that useful, but ISTR Linus saying that he wanted it this way.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part