netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: herbert@gondor.apana.org.au
Cc: netdev@vger.kernel.org
Subject: Re: [2/4] [IPV4]: Convert IPv4 devconf to an array
Date: Mon, 04 Jun 2007 23:17:54 -0700 (PDT)	[thread overview]
Message-ID: <20070604.231754.74747974.davem@davemloft.net> (raw)
In-Reply-To: <20070602100252.GB9247@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 2 Jun 2007 20:02:52 +1000

> @@ -64,20 +64,26 @@
>  #include <net/rtnetlink.h>
>  
>  struct ipv4_devconf ipv4_devconf = {
> -	.accept_redirects = 1,
> -	.send_redirects =  1,
> -	.secure_redirects = 1,
> -	.shared_media =	  1,
> +	.data = {
> +		[NET_IPV4_CONF_ACCEPT_REDIRECTS] = 1,
> +		[NET_IPV4_CONF_SEND_REDIRECTS] = 1,
> +		[NET_IPV4_CONF_SECURE_REDIRECTS] = 1,
> +		[NET_IPV4_CONF_SHARED_MEDIA] = 1,
> +	},
>  };

These array indexes are off by one.

This is the danger in using this "x-1" indexing style.
Such a mistake is way too easy to make.

  parent reply	other threads:[~2007-06-05  6:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02 10:01 [0/4] [IPV4]: Fix compatibility issue with ipv4_devconf_dflt Herbert Xu
2007-06-02 10:02 ` [1/4] [IPV4]: Only panic if inetdev_init fails for loopback Herbert Xu
2007-06-02 10:02 ` [2/4] [IPV4]: Convert IPv4 devconf to an array Herbert Xu
2007-06-02 11:47   ` jamal
2007-06-05  6:17   ` David Miller [this message]
2007-06-05  6:29     ` Herbert Xu
2007-06-05  6:31       ` [PATCH 1/4] [IPV4]: Only panic if inetdev_init fails for loopback Herbert Xu
2007-06-05  6:34         ` David Miller
2007-06-05  6:31       ` [PATCH 2/4] [IPV4]: Convert IPv4 devconf to an array Herbert Xu
2007-06-05  6:34         ` David Miller
2007-06-05  6:31       ` [PATCH 3/4] [IPV4]: Add default config support after inetdev_init Herbert Xu
2007-06-05  6:35         ` David Miller
2007-06-11 12:26         ` Patrick McHardy
2007-06-11 12:31           ` Herbert Xu
2007-06-05  6:31       ` [PATCH 4/4] [IPV4]: Restore old behaviour of default config values Herbert Xu
2007-06-05  6:36         ` David Miller
2007-06-02 10:03 ` [3/4] [IPV4]: Add default config support after inetdev_init Herbert Xu
2007-06-02 10:03 ` [4/4] [IPV4]: Restore old behaviour of default config values Herbert Xu

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=20070604.231754.74747974.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --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 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).