From patchwork Thu May 12 00:51:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 67626 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp495121qge; Wed, 11 May 2016 17:52:56 -0700 (PDT) X-Received: by 10.140.155.19 with SMTP id b19mr7141782qhb.14.1463014376846; Wed, 11 May 2016 17:52:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h8si7059861qge.32.2016.05.11.17.52.56; Wed, 11 May 2016 17:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 21C106163F; Thu, 12 May 2016 00:52:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C049361605; Thu, 12 May 2016 00:52:51 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B95DE615CA; Thu, 12 May 2016 00:52:48 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by lists.linaro.org (Postfix) with ESMTPS id CFC56615CA for ; Thu, 12 May 2016 00:51:43 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id x201so96023210oif.3 for ; Wed, 11 May 2016 17:51:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lXoelBueVAcIt4mLEi1y2MvYl882jcWdxpDARmsAfkQ=; b=k2mo2kl2xIX5swCDioHedzWrUcLlBbPDsVaFPZp+kfV4Pz2JnqSo5bdlmmXD5loFHc L0nwO0i9iBWKfXwzr9qdEYqEUv8GPIQwyaLSVGpIlug8Az7wJYJ9HO/s1hA0K5bPHyC+ EbasPpSpvHjvB9vWmL8bdEzVFKosXMgJUZevC2Z4VtxhQbBW5vjQs2/I9K6gwOfBGZl2 qUNdIjzBNvTr9rgvrDtjL+E1H5NF3WccU4COiilVT58sKbnznG8PS9obI7ItghYjzaJP 2/raJiXXbR+4YByxnObU1igT6RP/uxA6Wc+Nw6WAkJQYxxI4bt8UqTZnmed+phABpcF2 OI1A== X-Gm-Message-State: AOPr4FX+s+zHJV6xRpVd635yYPIgt+/vcPRPHWSOKXh1HzFxuzLxnswTnwB4TxcRdCg3mlal48c= X-Received: by 10.202.204.88 with SMTP id c85mr3449010oig.190.1463014303265; Wed, 11 May 2016 17:51:43 -0700 (PDT) Received: from localhost.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id s127sm3071559oie.4.2016.05.11.17.51.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 17:51:29 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 11 May 2016 19:51:18 -0500 Message-Id: <1463014278-10029-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 X-Topics: timers patch Subject: [lng-odp] [PATCH] validation: timer: verify timer successfully allocated X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2031 by adding a check to ensure that at least one timer is allocated before potentially dividing by zero. Signed-off-by: Bill Fischofer Reviewed-by: Mike Holmes --- test/validation/timer/timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index aad11aa..9d637d0 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -304,6 +304,8 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) tt[i].tick = TICK_INVALID; } allocated = i; + if (allocated == 0) + CU_FAIL_FATAL("unable to alloc a timer"); odp_atomic_fetch_add_u32(&timers_allocated, allocated); odp_barrier_wait(&test_barrier);