From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A62D48B8D; Fri, 28 Nov 2025 23:45:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3210C4066D; Fri, 28 Nov 2025 23:44:40 +0100 (CET) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by mails.dpdk.org (Postfix) with ESMTP id 3EEC9402F0 for ; Fri, 28 Nov 2025 23:44:35 +0100 (CET) Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-4ee158187aaso24595621cf.0 for ; Fri, 28 Nov 2025 14:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1764369874; x=1764974674; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EOI6bM27vEiVHSX6BhasBCTeQzit2WjXKfgoPCP+2QM=; b=wrJPWNNVPWC4oDD3u6FVv3Vuq5yRaDQiVML8FwGMn0E+4DFtP8QC+I+e+1edoVuI11 HO7Q90s7icdQ2SMdYOFTVatcZ5okBDSXEEBkKWWEqQV5QYhQNCsNopPElG1guf03bjV1 Rv/tIolsyQCB53iM+5qRX8R8uvrKsMrnRKWnK0WFWOdyjH5qtknKvFcorJiv6QdWtMnY 2v9WkQLoJTNdgcNhRtdavJ0MBZm6RDdMmzzZU8LVRrIkZySOcAJHYADFKC6vX5hEt5fS 86hf+l+ooxJkvgfzTht5sMFXURrHEzvPTObRJvsykX/eWCdYB3nmYWDKXW0cHk56687x dDBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764369874; x=1764974674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:sub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A9IE9cy3gDQTeySdJrnfqkgf9Hitup7Jb4WvQ== X-Google-Smtp-Source: AGHT+IHUA442R6ezRmWXUpeSuwxQHUU0osRs+0cuuj1XAmN8eQxJhYttuywgB1+vqOBGlSynyxYPrQ== X-Received: by 2002:a05:622a:1394:b0:4ee:1b36:b5b4 with SMTP id d75a77b69052e-4ee5883fc8cmr327844321cf.15.1764369874597; Fri, 28 Nov 2025 14:44:34 -0800 (PST) Received: from phoenix.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-886524e2b8asm37022216d6.16.2025.11.28.14.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Nov 2025 14:44:34 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , Akhil Goyal , Fan Zhang , Hemant Agrawal , Ciara Power , Declan Doherty Subject: [PATCH v8 07/10] test: fix format overflow in cryptodev test Date: Fri, 28 Nov 2025 14:42:10 -0800 Message-ID: <20251128224420.195013-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251128224420.195013-1-stephen@networkplumber.org> References: <20251110182209.104087-1-stephen@networkplumber.org> <20251128224420.195013-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The vdev args buffer could in theory get truncated if there were lots of sockets or lcores. Handle that by checking return value of snprintf. Fixes: 8bfdd8a7f0f1 ("test/crypto: refactor to use sub test suites") Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- app/test/test_cryptodev.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9bdd357727..bd6a2d3fa6 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -17713,8 +17713,16 @@ scheduler_testsuite_setup(void) RTE_LCORE_FOREACH_WORKER(i) { if (worker_core_count > 1) break; - snprintf(vdev_args, sizeof(vdev_args), - "%s%d", temp_str, i); + ret = snprintf(vdev_args, sizeof(vdev_args), + "%s%d", temp_str, i); + + /* If too many args the result will have been truncated */ + if (ret >= VDEV_ARGS_SIZE) { + RTE_LOG(ERR, USER1, + "Cryptodev scheduler test vdev arg size exceeded\n"); + return TEST_FAILED; + } + strcpy(temp_str, vdev_args); strlcat(temp_str, ";", sizeof(temp_str)); worker_core_count++; @@ -17728,8 +17736,14 @@ scheduler_testsuite_setup(void) return TEST_FAILED; } strcpy(temp_str, vdev_args); - snprintf(vdev_args, sizeof(vdev_args), "%s,socket_id=%d", - temp_str, socket_id); + ret = snprintf(vdev_args, sizeof(vdev_args), "%s,socket_id=%d", + temp_str, socket_id); + if (ret >= VDEV_ARGS_SIZE) { + RTE_LOG(ERR, USER1, + "Cryptodev scheduler test vdev arg size exceeded\n"); + return TEST_FAILED; + } + RTE_LOG(DEBUG, USER1, "vdev_args: %s\n", vdev_args); nb_devs = rte_cryptodev_device_count_by_driver( rte_cryptodev_driver_id_get( -- 2.51.0