]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_lpm/rte_lpm.c
lpm: fix overflow issue
[dpdk.git] / lib / librte_lpm / rte_lpm.c
index 983e04b1598edb8f55634226653b969336d60e70..cc51210c435631727d04dee12a29f550fd9a874e 100644 (file)
@@ -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;