The code for parsing layers in devargs could reference past
the end of layers[] array on stack.

Link: https://pvs-studio.com/en/blog/posts/cpp/1183/

Fixes: 9a1a9e4a2ddd ("devargs: support path value with global device syntax")
Cc: xuemi...@nvidia.com
Cc: sta...@dpdk.org
Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/eal/common/eal_common_devargs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_devargs.c 
b/lib/eal/common/eal_common_devargs.c
index a64805b268..dd857fc839 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -88,7 +88,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
        s = devargs->data;
 
        while (s != NULL) {
-               if (nblayer > RTE_DIM(layers)) {
+               if (nblayer >= RTE_DIM(layers)) {
                        ret = -E2BIG;
                        goto get_out;
                }
-- 
2.45.2

Reply via email to