DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lpm: fix overflow issue
@ 2015-02-20 13:16 Igor Ryzhov
  2015-02-21 22:56 ` Igor Ryzhov
  2015-02-22 20:29 ` Bruce Richardson
  0 siblings, 2 replies; 6+ messages in thread
From: Igor Ryzhov @ 2015-02-20 13:16 UTC (permalink / raw)
  To: dev; +Cc: Igor Ryzhov

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@nfware.com>
---
 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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-24  1:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 13:16 [dpdk-dev] [PATCH] lpm: fix overflow issue Igor Ryzhov
2015-02-21 22:56 ` Igor Ryzhov
2015-02-22 18:40   ` Richardson, Bruce
2015-02-22 18:47     ` Igor Ryzhov
2015-02-22 20:29 ` Bruce Richardson
2015-02-24  1:09   ` Thomas Monjalon

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).