netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH 2.6 NET] Catch wrong RTATTR_MAX with BUG()
Date: Thu, 9 Sep 2004 09:55:31 -0700	[thread overview]
Message-ID: <20040909095531.331fd168.davem@davemloft.net> (raw)
In-Reply-To: <20040909164346.GA18994@postel.suug.ch>

On Thu, 9 Sep 2004 18:43:46 +0200
Thomas Graf <tgraf@suug.ch> wrote:

> Catches outdated/invalid RTATTR_MAX and therefore avoids possible stack
> corruption.

Your test has an off by one error, but more importantly,
it's probably better to do this at compile time with
something like:

extern void rtattr_max_too_small(void);

...

void __init rtnetlink_init(void)
{
	if (IFLA_MAX > RTATTR_MAX ||
	    IFA_MAX > RTATTR_MAX ||
	    RTA_MAX > RTATTR_MAX ||
	    NDA_MAX > RTATTR_MAX ||
	    TCA_MAX > RTATTR_MAX ||
	    TCAA_MAX > RTATTR_MAX)
		rtattr_max_too_small();

I would therefore accept a patch that did things
this way.  BUG()'ing at runtime for something like
this is too rude. :)

Thanks.

  reply	other threads:[~2004-09-09 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-09 16:43 [PATCH 2.6 NET] Catch wrong RTATTR_MAX with BUG() Thomas Graf
2004-09-09 16:55 ` David S. Miller [this message]
2004-09-09 17:24 ` YOSHIFUJI Hideaki / 吉藤英明

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=20040909095531.331fd168.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@oss.sgi.com \
    --cc=tgraf@suug.ch \
    /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).