linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: linux-sparse@vger.kernel.org
Subject: linux kernel warnings/errors
Date: Tue, 23 Feb 2010 11:49:06 -0800	[thread overview]
Message-ID: <20100223114906.61d4e001.rdunlap@xenotime.net> (raw)

Hi,

You probably know that sparse produces a ton of errors & warnings when
run on the Linux kernel tree (a little over 1 MB in my latest 'make C=1'
on x86_64 arch.).

I'm wondering if all of these are valid.

Examples:


1.  Use of the BUILD_BUG_ON() macro causes this error from sparse:

arch/x86/kernel/paravirt.c:101:9: error: invalid bitfield width, -1.

include/linux/kernel.h:

/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))

/* Force a compilation error if condition is true, but also produce a
   result (of value 0 and type size_t), so the expression can be used
   e.g. in a structure initializer (or where-ever else comma expressions
   aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))


2.  drivers/block/drbd/drbd_int.h uses __protected_by(var);
this seems to be unknown to sparse.

#ifdef __CHECKER__
# define __protected_by(x)       __attribute__((require_context(x,1,999,"rdwr")))

sparse says many times:

drivers/block/drbd/drbd_int.h:887:39: error: attribute 'require_context': unknown attribute


3.  I don't see the problem here -- maybe it's simple (or maybe it's
related to BUILD_BUG_ON stuff):

drivers/char/ipmi/ipmi_watchdog.c:291:1: error: cannot dereference this type

referring to:

module_param_call(action, set_param_str, get_param_str, action_op, 0644);

which comes from include/linux/moduleparam.h


4.  from include/linux/swab.h:

include/linux/swab.h:51:16: warning: unreplaced symbol 'val'
include/linux/swab.h:51:16: warning: unreplaced symbol 'val'
include/linux/swab.h:51:9: warning: unreplaced symbol 'return'

referring to:

static inline __attribute_const__ __u16 __fswab16(__u16 val)
{
#ifdef __arch_swab16
	return __arch_swab16(val);
#else
	return ___constant_swab16(val);
#endif
}


5.  sparse reports (maybe correctly?):

include/linux/skbuff.h:357:41: error: invalid bitfield specifier for type restricted __be16.

on struct sk_buff, this line:

	__be16			protocol:16;


6.  sparse reports:

drivers/usb/gadget/zero.c:166:9: warning: advancing past deep designator

on

static struct usb_string strings_dev[] = {
	[STRING_MANUFACTURER_IDX].s = manufacturer,
	[STRING_PRODUCT_IDX].s = longname,
	[STRING_SERIAL_IDX].s = serial,
	{  }			/* end of list */
};

Is that an improper initializer?  The sparse warning doesn't mean much to me.



Thanks for listening, insights, etc.

---
~Randy

             reply	other threads:[~2010-02-23 19:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 19:49 Randy Dunlap [this message]
2010-02-23 20:59 ` linux kernel warnings/errors Josh Triplett
2010-02-23 22:20   ` Randy Dunlap
2010-02-23 22:40 ` linux kernel warnings/errors (#7) Randy Dunlap
2010-02-24  0:55 ` linux kernel warnings/errors (#8) Randy Dunlap

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=20100223114906.61d4e001.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=linux-sparse@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).