mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: roel <12o3l@tiscali.nl>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] removes array_size duplicates
Date: Mon, 1 Oct 2007 05:48:59 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710010546340.15688@localhost.localdomain> (raw)
In-Reply-To: <20071001022653.40bd5714.akpm@linux-foundation.org>

On Mon, 1 Oct 2007, Andrew Morton wrote:

> On Fri, 28 Sep 2007 00:51:13 +0200 roel <12o3l@tiscali.nl> wrote:
>
> > This patch removes some ARRAY_SIZE macro duplicates. There is also one in
> > arch/um/include/user.h, which isn't fixed here because comments in that file
> > explicitly state a preference for the 'less fancy' version. If that's the
> > case as well for any of the other replacements please comment.
>
> I got a bunch of rejects against various development trees, a
> build error in net/ipv4/ipvs/ip_vs_proto_udp.c and now
>
> net/netfilter/xt_sctp.c: In function 'match_packet':
> net/netfilter/xt_sctp.c:58: error: size of array 'type name' is negative
> net/netfilter/xt_sctp.c:106: error: size of array 'type name' is negative

among other things, one of the creepy issues here is the definition in
include/linux/netfilter/xt_sctp.h of the macro:

...
#define SCTP_CHUNKMAP_COPY(destmap, srcmap)                     \
        do {                                                    \
                int i;                                          \
                for (i = 0; i < ELEMCOUNT(chunkmap); i++)       \
                        destmap[i] = srcmap[i];                 \
        } while (0)
...

  i'm not a big fan of macros that refer to objects that aren't
parameters to the macro, especially when all the rest of them *do*.

rday

p.s.  ELEMCOUNT is simply an alternative to ARRAY_SIZE, which could
certainly be rewritten that way.

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

  parent reply	other threads:[~2007-10-01  9:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 22:51 roel
2007-10-01  9:26 ` Andrew Morton
2007-10-01  9:33   ` Geert Uytterhoeven
2007-10-01  9:39     ` Andrew Morton
2007-10-01  9:48   ` Robert P. J. Day [this message]
2007-10-01  9:55     ` Robert P. J. Day

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=Pine.LNX.4.64.0710010546340.15688@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=12o3l@tiscali.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®