From patchwork Mon Nov 24 01:17:27 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: kbuild test robot X-Patchwork-Id: 10349 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id BE59DDDDFB for ; Mon, 24 Nov 2008 12:19:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbYKXBRj (ORCPT ); Sun, 23 Nov 2008 20:17:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751133AbYKXBRj (ORCPT ); Sun, 23 Nov 2008 20:17:39 -0500 Received: from mga14.intel.com ([143.182.124.37]:49850 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbYKXBRj (ORCPT ); Sun, 23 Nov 2008 20:17:39 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 23 Nov 2008 17:17:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.33,655,1220252400"; d="scan'208";a="81284948" Received: from unknown (HELO localhost) ([10.254.153.180]) by azsmga001.ch.intel.com with ESMTP; 23 Nov 2008 17:17:32 -0800 Received: from wfg by localhost with local (Exim 4.69) (envelope-from ) id 1L4Q4t-0001hV-Ek; Mon, 24 Nov 2008 09:17:27 +0800 Date: Mon, 24 Nov 2008 09:17:27 +0800 From: Wu Fengguang To: Wang Chen Cc: David Miller , "kaber@trash.net" , "netdev@vger.kernel.org" Subject: Re: [PATCH] netfilter: nf_conntrack_sctp: fix build warning Message-ID: <20081124011727.GA6462@localhost> References: <20081123113315.GA16697@localhost> <20081123.135955.202482968.davem@davemloft.net> <20081124000652.GA5424@localhost> <4929FEA9.9090801@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4929FEA9.9090801@cn.fujitsu.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 > >> 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 > > --- > > > > 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 --- DISCLAIMER: I'm newbie to the code, and this fix could be wrong! -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 &&