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 E908AA0C51 for ; Wed, 21 Jul 2021 17:28:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D353E40DF4; Wed, 21 Jul 2021 17:28:29 +0200 (CEST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by mails.dpdk.org (Postfix) with ESMTP id C140A40143; Wed, 21 Jul 2021 17:28:27 +0200 (CEST) Received: by mail-lf1-f46.google.com with SMTP id f30so3787064lfj.1; Wed, 21 Jul 2021 08:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RHuQEz3mzRmJajivy/usUjJgDPEIH5cZ5mUdn79hQxg=; b=tH4cs2PYWRfKUNhkhbkIahzGjo2DZXA//gAkZilEnq5Y4pRoZZy9SZi9WXoyxqjPVK r5gkHgJajQkMBxTWwnft0m5t6junQiXZCSUTbA2T5Hw0SnuQUWUSfv90UfRBAtnRpm0n 7otbkfmCUVOvraUNeaKK6TUP267eGaK+DuLi5yZyAdB/W7T6R1yx3y2WUt+exDyTUaFW izbKOnS9/Dj0ddZkCi/mGFFj9ur8plrF7cWoNBtQCsBiNsckQYSrW3xFOU+dqeOOczGF TypUjGsq8m+9k2kk59cWdbIpTXFVbiwPZ7l2m6s4RW8qf5zGWSCma76WQg1Sa8m7mqxG EDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RHuQEz3mzRmJajivy/usUjJgDPEIH5cZ5mUdn79hQxg=; b=CredTpgoCg7eYWAHWAaohrSDbDDf4nucPLA1JI3pMSGxQI3A+Ur0Ud0wwh+2gmB8mN oHFzHgBgXCSlXhG/1FCROo1zf9tWApiOYhMFWN01LXwwh8BP+h7ZgpKb1ehQwKGRBPro sbw8A/WPE3Q6cnEjzi7FR5adg1qPR9hnfnpYlkPZww2zPhGGHLGEp+ElK9MLEd8+Xzj8 pJWv+8NY8C3S454zE5WbSMVDrV1PaS0CBt0a2ILXEfFE4MM0EDMywi/xccvHA4eQrcYw 9IEgUPgmU6ypNQqRUkCqNk2pGhiAB5DcvcDQ3I0Rr65yu2SSra18YhOBWUTBn64tPDI8 i8UQ== X-Gm-Message-State: AOAM532ui4gISvNr+0fLRgj9Lyt7VQvtH3UPzBWVZwvriY3JQUDlZ10C 57W9Nz67Bgl4BJ/ArvmB/lM= X-Google-Smtp-Source: ABdhPJz6+WGF/HAhziaL9Jif6fNTEnDKMc2wJIZnqLPZ1Ied9NZK+FNdtB/H+5466Sl/Pnz1P4uOdA== X-Received: by 2002:ac2:494c:: with SMTP id o12mr19928735lfi.229.1626881307349; Wed, 21 Jul 2021 08:28:27 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id g11sm1093745lfv.291.2021.07.21.08.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 08:28:26 -0700 (PDT) Date: Wed, 21 Jul 2021 18:28:25 +0300 From: Dmitry Kozlyuk To: Jie Zhou Cc: dev@dpdk.org, roretzla@microsoft.com, talshn@nvidia.com, pallavi.kadam@intel.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, david.marchand@redhat.com, stable@dpdk.org Message-ID: <20210721182825.76c169a4@sovereign> In-Reply-To: <1625689538-6747-1-git-send-email-jizh@linux.microsoft.com> References: <1624495001-16613-1-git-send-email-jizh@linux.microsoft.com> <1625689538-6747-1-git-send-email-jizh@linux.microsoft.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH v2] eal/windows: enforce alarm APIs parameter check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 2021-07-07 13:25 (UTC-0700), Jie Zhou: > eal/windows alarm APIs rte_eal_alarm_set and rte_eal_alarm_cancel > did not check parameters to fail fast for invalid parameters, which > caught by DPDK UT alarm_autotest. > > Enforce eal/windows alarm APIs parameter check to fail fast for > invalid parameters. > > Fixes: f4cbdbc7fbd2 ("eal/windows: implement alarm API") > Cc: stable@dpdk.org > > Signed-off-by: Jie Zhou > > --- > V2 changes: > - Remove API parameter check on arbitrary 'us' range > - Do explicit NULL cb_fn check > > --- > lib/eal/windows/eal_alarm.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c > index f5bf88715a..e5dc54efb8 100644 > --- a/lib/eal/windows/eal_alarm.c > +++ b/lib/eal/windows/eal_alarm.c > @@ -91,6 +91,12 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg) > LARGE_INTEGER deadline; > int ret; > > + if (cb_fn == NULL) { > + RTE_LOG(ERR, EAL, "NULL callback\n"); > + ret = -EINVAL; > + goto exit; > + } > + > /* Calculate deadline ASAP, unit of measure = 100ns. */ > GetSystemTimePreciseAsFileTime(&ft); > deadline.LowPart = ft.dwLowDateTime; > @@ -180,6 +186,12 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg) > bool executing; > > removed = 0; > + > + if (cb_fn == NULL) { > + RTE_LOG(ERR, EAL, "NULL callback\n"); > + return -EINVAL; > + } > + > do { > executing = false; > Acked-by: Dmitry Kozlyuk