From patchwork Thu Aug 8 19:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 143028 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 241044576E; Thu, 8 Aug 2024 21:48:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 976C742D8C; Thu, 8 Aug 2024 21:48:10 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mails.dpdk.org (Postfix) with ESMTP id 8F61542D92 for ; Thu, 8 Aug 2024 21:48:08 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7a23fbb372dso1028501a12.0 for ; Thu, 08 Aug 2024 12:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1723146488; x=1723751288; 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=jXPhvXK1VIpf6boz2Rwgf9kQO+JhMST6iysb/fpeHlk=; b=ywF0UbS84ksxVkwOH61U16edwFvAWywzTyA5veoNvtsvRRORQyq85uWz9SYe2mW13b q7HrNWwlOwtzLkJwkk3WtLVG6Qm8Lcve7kF27vYvBWGsHLaV5Jjr8UgK90JAo3yajMu5 R08lm2zU+ZBTgQEGV3FmNx00GnvJW+l+LsQrnuO+CAhvKaBhF1B22PArl/j1EfJiCYd3 iM0A7LfJemrrLq39xrxxvTDMQiwC9SvpZ6qrjPB8BBmzCY3Ylgw9USZ9TU/ZQqkoj840 dXhAjxr2VAULvPjKETtqF7vCitInH2WSBXx2dPojaGwT/ySNFIa2VvyQI+iw8+CLpzAI yBaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723146488; x=1723751288; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jXPhvXK1VIpf6boz2Rwgf9kQO+JhMST6iysb/fpeHlk=; b=OdmIxeBiNhjar6seHwcBbdxl8OEsuBUR5DZEpts1R7jBJ7aMEVJoS5YuYi79XJlnx4 qTb+wLiztXLxwwRN/cU1Ohvzp6lLQpiRwHCdo7CREUucmrDxl988RTiKA1FsHiQNu3l5 ElrTmV9GQZdJu42plrW+mthd4dpavZhGqihkiUIjogfvDFvv4mkZEi1awNQZvGUeYOa8 ToHv9e4+XHYI6th59ElgzbUuPW2O8KtiugFGsBYZnOFKWDk3msr01vPG/VfaQ7/B0Tx1 S79G7njX6tCWAEpJWmYyWVY4ZStoaUT6I16l6ommmGXa2gBoKeL6ZY/cekJalDjzrydz t7YQ== X-Gm-Message-State: AOJu0YxfCAcgqrdc5wHTEsDDaT+V+XlWyUfxkWqMXOc/GupkJr9qEEbb dkAg80oBqL6AnqlI9tp6SHrILI5NrPzVIhT7LFLmyE36QVtQWxTFbCMXrA531SR4uI3uklATp/u a X-Google-Smtp-Source: AGHT+IFqBGofPK9sXmzTQMSp1kWyELiWsPFiXq8hKBX+GjExBbqqNazyM8hpQxhIdGC+oDqvrBUvgQ== X-Received: by 2002:a05:6a20:7347:b0:1c6:fc9f:eb68 with SMTP id adf61e73a8af0-1c6fcfd8be1mr3496863637.50.1723146487685; Thu, 08 Aug 2024 12:48:07 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710cb2d376csm1469804b3a.111.2024.08.08.12.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 12:48:07 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Dmitry Kozlyuk , Tyler Retzlaff , Pallavi Kadam Subject: [PATCH 1/5] eal: add missing parameter check to rte_eal_alarm_set on Windows Date: Thu, 8 Aug 2024 12:46:57 -0700 Message-ID: <20240808194756.167664-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240808194756.167664-1-stephen@networkplumber.org> References: <20240808194756.167664-1-stephen@networkplumber.org> MIME-Version: 1.0 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 Both Linux and FreeBSD, check parameters to rte_eal_alarm_set, but Windows missed this. And the test was "fixed" instead. Signed-off-by: Stephen Hemminger --- lib/eal/windows/eal_alarm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c index 052af4b21b..09a02a1cbf 100644 --- a/lib/eal/windows/eal_alarm.c +++ b/lib/eal/windows/eal_alarm.c @@ -92,6 +92,13 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg) LARGE_INTEGER deadline; int ret; + /* Check parameters, including that us won't cause a uint64_t overflow */ + if (us < 1 || us > (UINT64_MAX - US_PER_S)) { + EAL_LOG(ERR, "Invalid alarm interval"); + ret = -EINVAL; + goto exit; + } + if (cb_fn == NULL) { EAL_LOG(ERR, "NULL callback"); ret = -EINVAL;