All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Wang Chen <wangchen@cn.fujitsu.com>
Cc: David Miller <davem@davemloft.net>,
	"kaber@trash.net" <kaber@trash.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] netfilter: nf_conntrack_sctp: fix build warning
Date: Mon, 24 Nov 2008 09:17:27 +0800	[thread overview]
Message-ID: <20081124011727.GA6462@localhost> (raw)
In-Reply-To: <4929FEA9.9090801@cn.fujitsu.com>

On Mon, Nov 24, 2008 at 03:08:57AM +0200, Wang Chen wrote:
> Wu Fengguang said the following on 2008-11-24 8:06:
> > On Sun, Nov 23, 2008 at 11:59:55PM +0200, David Miller wrote:
> >> From: Wu Fengguang <fengguang.wu@intel.com>
> >> Date: Sun, 23 Nov 2008 19:33:15 +0800
> >>
> >> linux-net is not the mailing list for network development
> >> discussion, it is for user questions.  Post patches and
> >> developer questions to netdev@vger.kernel.org instead.
> > 
> > OK, thanks for the CC!
> > 
> > Fengguang
> > ---
> > 
> > net/netfilter/nf_conntrack_proto_sctp.c: In function ‘sctp_packet’:
> > net/netfilter/nf_conntrack_proto_sctp.c:376: warning: array subscript is above array bounds
> > 
> > Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
> > ---
> > 
> > DISCLAIMER: I'm newbie to the code, and this fix could be wrong!
> > 
> > diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
> > index ae8c260..d31ced4 100644
> > --- a/net/netfilter/nf_conntrack_proto_sctp.c
> > +++ b/net/netfilter/nf_conntrack_proto_sctp.c
> > @@ -373,6 +373,9 @@ static int sctp_packet(struct nf_conn *ct,
> >  	}
> >  	write_unlock_bh(&sctp_lock);
> >  
> > +	if (new_state == SCTP_CONNTRACK_MAX)
> > +		goto out;
> > +
> 
> print some debug info would be better?

Like this one?
+		pr_debug("Empty sctp packet\n");

Fengguang
---
netfilter: nf_conntrack_sctp: fix build warning

net/netfilter/nf_conntrack_proto_sctp.c: In function ‘sctp_packet’:
net/netfilter/nf_conntrack_proto_sctp.c:376: warning: array subscript is above array bounds

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
---

DISCLAIMER: I'm newbie to the code, and this fix could be wrong!

diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index ae8c260..a0bc24b 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -373,6 +373,11 @@ static int sctp_packet(struct nf_conn *ct,
 	}
 	write_unlock_bh(&sctp_lock);
 
+	if (new_state == SCTP_CONNTRACK_MAX) {
+		pr_debug("Empty sctp packet\n");
+		goto out;
+	}
+
 	nf_ct_refresh_acct(ct, ctinfo, skb, sctp_timeouts[new_state]);
 
 	if (old_state == SCTP_CONNTRACK_COOKIE_ECHOED &&

  reply	other threads:[~2008-11-24  1:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081123113315.GA16697@localhost>
2008-11-23 21:59 ` [PATCH] netfilter: nf_conntrack_sctp: fix build warning David Miller
2008-11-24  0:06   ` Wu Fengguang
2008-11-24  1:08     ` Wang Chen
2008-11-24  1:17       ` Wu Fengguang [this message]
2008-11-24 12:23         ` Patrick McHardy
2008-11-24 12:35           ` Wu Fengguang
2008-11-24 12:48             ` Patrick McHardy
2008-11-24 12:50               ` Wu Fengguang

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=20081124011727.GA6462@localhost \
    --to=fengguang.wu@intel.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=wangchen@cn.fujitsu.com \
    /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.