dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] lpm: fix overflow issue
Date: Sun, 22 Feb 2015 20:29:00 +0000	[thread overview]
Message-ID: <20150222202859.GA6840@bricha3-MOBL3> (raw)
In-Reply-To: <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>

On Fri, Feb 20, 2015 at 04:16:46PM +0300, Igor Ryzhov wrote:
> LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules.
> 
> Signed-off-by: Igor Ryzhov <iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
Acked-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> ---
>  lib/librte_lpm/rte_lpm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
> index 983e04b..cc51210 100644
> --- a/lib/librte_lpm/rte_lpm.c
> +++ b/lib/librte_lpm/rte_lpm.c
> @@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
>  				return rule_index;
>  			}
>  		}
> +
> +		if (rule_index == lpm->max_rules)
> +			return -ENOSPC;
>  	} else {
>  		/* Calculate the position in which the rule will be stored. */
>  		rule_index = 0;
> -- 
> 1.9.3 (Apple Git-50)
> 

  parent reply	other threads:[~2015-02-22 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 13:16 [PATCH] lpm: fix overflow issue Igor Ryzhov
     [not found] ` <1424438206-29526-1-git-send-email-iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.org>
2015-02-21 22:56   ` Igor Ryzhov
     [not found]     ` <CAF+s_FyLywggUfOL55qdkzT=kb=RTQ6DiscOcObTn+6+Q+gH4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-22 18:40       ` Richardson, Bruce
     [not found]         ` <19E2A698-96BB-4CFE-9BCE-50AFB815D24B-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-22 18:47           ` Igor Ryzhov
2015-02-22 20:29   ` Bruce Richardson [this message]
2015-02-24  1:09     ` Thomas Monjalon

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=20150222202859.GA6840@bricha3-MOBL3 \
    --to=bruce.richardson-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=iryzhov-KFClsOz4rnbQT0dZR+AlfA@public.gmane.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).