netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Oester <kernel@linuxace.com>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org
Subject: Re: [PATCH] iptables: set errno correctly in iptcc_chain_index_alloc
Date: Thu, 4 Jul 2013 09:18:45 -0700	[thread overview]
Message-ID: <20130704161845.GA11465@linuxace.com> (raw)
In-Reply-To: <20130704074222.GC2351@breakpoint.cc>

On Thu, Jul 04, 2013 at 09:42:22AM +0200, Florian Westphal wrote:
> Personally I think libraries should not change errno at all.

OK, but then we output misleading error messages.

> I don't understand how this changes anything?

Simulate an out of memory condition with this patch

@@ -500,9 +500,11 @@ static int iptcc_chain_index_alloc(struct xtc_handle *h)
              array_elems, array_mem);

        h->chain_index = malloc(array_mem);
-       if (h->chain_index == NULL && array_mem > 0) {
+       //if (h->chain_index == NULL && array_mem > 0) {
+       if (1) {
                h->chain_index_sz = 0;

With the patch, the error message returned to user:

   ...can't initialize iptables table `filter': Memory allocation problem

without the patch:

   ...can't initialize iptables table `filter': Incompatible with this kernel

The former seems better, no?

Phil

  reply	other threads:[~2013-07-04 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04  1:16 [PATCH] iptables: set errno correctly in iptcc_chain_index_alloc Phil Oester
2013-07-04  7:42 ` Florian Westphal
2013-07-04 16:18   ` Phil Oester [this message]
2013-07-04 16:33     ` Florian Westphal
2013-07-04 16:52       ` Phil Oester

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=20130704161845.GA11465@linuxace.com \
    --to=kernel@linuxace.com \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).