From patchwork Thu May 26 23:46:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 68719 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp658928qge; Thu, 26 May 2016 16:48:56 -0700 (PDT) X-Received: by 10.140.167.130 with SMTP id n124mr11584154qhn.23.1464306536172; Thu, 26 May 2016 16:48:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t79si15039882qhb.31.2016.05.26.16.48.55; Thu, 26 May 2016 16:48: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 B9DFA61737; Thu, 26 May 2016 23:48:55 +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 86E0F67450; Thu, 26 May 2016 23:47: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 CC1076745D; Thu, 26 May 2016 23:47:46 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.linaro.org (Postfix) with ESMTPS id CD5E461737 for ; Thu, 26 May 2016 23:47:01 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id b65so149392347oia.1 for ; Thu, 26 May 2016 16:47:01 -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:in-reply-to :references; bh=Aesb/z1wVhp3/Odo8L3uKLcdWfQbJ4Fqe+dn4AdoRSg=; b=Vn4YE6wuPsDzkuQoUHCEQRJDG0MNcPVmiMPe1l6E+bPolHOIy4117jgVz7weWysxZU y5qGO3FHEeAQhFYk4hMPkaxZYxx9kW2Y2oYKoGw3CGP5+I3ZrQVZyAzJHVy9l1BOcBXF vhidmuKXPUqnCCNZMjrybjINak15FrQreUSvBW8v9/3poFBhS699Q6y3um//ZWaNRKOK xXlj7bx30PkN3mk9ycXJVwvsyjhcaBfqWUhIhgyrL0Cjcc0l1iYEE/kc/Cd0cQ/y0Xji pH+jznhEoDxFFpeawvD4fDvadjWRnAfOzLD8eHZGrnSFmxwe+yUr+Qrzc9LqGrvSNnkx aeYA== X-Gm-Message-State: ALyK8tIFozDAvIK9aWC2BSgqHi8iy4ksP8fafa9CsA9w+Rvsvpt7G4u/GrCEfiR0baMulOK5c4M= X-Received: by 10.202.60.131 with SMTP id j125mr6771623oia.42.1464306421189; Thu, 26 May 2016 16:47:01 -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 c7sm7720581oia.8.2016.05.26.16.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 May 2016 16:47:00 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 26 May 2016 18:46:45 -0500 Message-Id: <1464306409-7325-7-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464306409-7325-1-git-send-email-bill.fischofer@linaro.org> References: <1464306409-7325-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 06/10] linux-generic: tm: avoid underflow on log2 of 0 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" Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_timer_wheel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index a8717b7..66600b7 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -166,6 +166,9 @@ static uint32_t _odp_internal_ilog2(uint64_t value) uint64_t pwr_of_2; uint32_t bit_shift; + if (value == 0) + return 64; + for (bit_shift = 0; bit_shift < 64; bit_shift++) { pwr_of_2 = 1ULL << bit_shift; if (value == pwr_of_2)