All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Ketrenos <jketreno@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: NetDev <netdev@vger.kernel.org>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: warnings in git-wireless
Date: Wed, 06 Jun 2007 15:33:46 -0700	[thread overview]
Message-ID: <4667364A.4040803@linux.intel.com> (raw)
In-Reply-To: <20070606163534.6a6cffb7.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Wed, 06 Jun 2007 13:51:41 -0700 James Ketrenos <jketreno@linux.intel.com> wrote:
> 
>>>>  * make C=2 CF=-Wall will complain if you use ARRAY_SIZE on global data
>>>>  */
>>>> #define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>> This is identical to ARRAY_SIZE.
>>>
>>> And if there's some problem with ARRAY_SIZE then fix ARRAY_SIZE!  Don't go 
>>> off and create some private thing and leave everyone else twisting in the
>>> wind.
>> The code was resolving the sparse warnings.  
> 
...
> Your GLOBAL_ARRAY_SIZE() is, afaict, identical to ARRAY_SIZE().

>From include/linux/kernel.h

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

>From drivers/net/wireless/mac80211/iwlwifi/iwl-helpers.h

#define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

The '+ __must_be_array(arr)' part of ARRAY_SIZE was causing sparse to complain 
with:

drivers/net/wireless/mac80211/iwlwifi/base.c:4646:22: error: cannot size expression
...

When I had run my builds, I had restricted the sparse checks to just iwlwifi 
(vs. checking the rest of the kernel).

I just ran it C=2 CF=-Wall against the rest of the kernel and do see other code 
with the same problem, eg:

sound/core/memalloc.c:521:14: error: cannot size expression
...

I had erroneously thought it was just a problem with iwlwifi...

Thanks,
James

WARNING: multiple messages have this Message-ID (diff)
From: James Ketrenos <jketreno-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: NetDev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-wireless
	<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: warnings in git-wireless
Date: Wed, 06 Jun 2007 15:33:46 -0700	[thread overview]
Message-ID: <4667364A.4040803@linux.intel.com> (raw)
In-Reply-To: <20070606163534.6a6cffb7.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>

Andrew Morton wrote:
> On Wed, 06 Jun 2007 13:51:41 -0700 James Ketrenos <jketreno-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
> 
>>>>  * make C=2 CF=-Wall will complain if you use ARRAY_SIZE on global data
>>>>  */
>>>> #define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>> This is identical to ARRAY_SIZE.
>>>
>>> And if there's some problem with ARRAY_SIZE then fix ARRAY_SIZE!  Don't go 
>>> off and create some private thing and leave everyone else twisting in the
>>> wind.
>> The code was resolving the sparse warnings.  
> 
...
> Your GLOBAL_ARRAY_SIZE() is, afaict, identical to ARRAY_SIZE().

>From include/linux/kernel.h

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

>From drivers/net/wireless/mac80211/iwlwifi/iwl-helpers.h

#define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

The '+ __must_be_array(arr)' part of ARRAY_SIZE was causing sparse to complain 
with:

drivers/net/wireless/mac80211/iwlwifi/base.c:4646:22: error: cannot size expression
...

When I had run my builds, I had restricted the sparse checks to just iwlwifi 
(vs. checking the rest of the kernel).

I just ran it C=2 CF=-Wall against the rest of the kernel and do see other code 
with the same problem, eg:

sound/core/memalloc.c:521:14: error: cannot size expression
...

I had erroneously thought it was just a problem with iwlwifi...

Thanks,
James

  reply	other threads:[~2007-06-07  0:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05  9:06 warnings in git-wireless Andrew Morton
2007-06-05  9:06 ` Andrew Morton
2007-06-05 11:57 ` John W. Linville
2007-06-05 11:57   ` John W. Linville
2007-06-05 20:12   ` James Ketrenos
2007-06-05 20:12     ` James Ketrenos
2007-06-05 23:26     ` Andrew Morton
2007-06-06  7:20     ` Christoph Hellwig
2007-06-06 14:14       ` James Ketrenos
2007-06-06 20:51 ` James Ketrenos
2007-06-06 23:35   ` Andrew Morton
2007-06-06 22:33     ` James Ketrenos [this message]
2007-06-06 22:33       ` James Ketrenos
2007-06-07  1:04       ` Andrew Morton
2007-06-07  1:13         ` Dave Jones
2007-06-07  0:00     ` Randy Dunlap
2007-06-07  0:00       ` 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=4667364A.4040803@linux.intel.com \
    --to=jketreno@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.