From patchwork Wed May 25 23:37:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 68653 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp113508qge; Wed, 25 May 2016 16:46:16 -0700 (PDT) X-Received: by 10.55.103.65 with SMTP id b62mr6405193qkc.177.1464219976297; Wed, 25 May 2016 16:46:16 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z1si10619341qtb.34.2016.05.25.16.46.16; Wed, 25 May 2016 16:46:16 -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 F184F617E3; Wed, 25 May 2016 23:46:15 +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 EB976617ED; Wed, 25 May 2016 23:45:50 +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 552F8617E3; Wed, 25 May 2016 23:45:36 +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 B2A21616B1 for ; Wed, 25 May 2016 23:45:26 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id w184so92727831oiw.2 for ; Wed, 25 May 2016 16:45:26 -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=1Sol4kjjbD8w/RoSEo/DQLizlBxB9JTN3ql/WB2WjZ4=; b=OhTP/mCIIF5vH0QiSlnvsG43lCsVOBnL70UgfYIqptHNzaZvr6nOyC3RKOPmj+jQ84 r86xj5JBw/r7QooKBEJlAAbkuLmgLv8HEudflil7G0uFGdKKdJTIqtMODGIXhFxDN4gG tiLhMpkRUlDeMKONWdh+JL8XgmwS3vaK3BkYSJWnrjiHQTYiCVNXn2ycUiYSEA8MeyZJ DRq6pxSPkgLHOUHrr9Y9M9QcVN175jfsIJS1jXKQ4o3f7xTZHjaJPsE52MXnJQ9cTnol laBuJ61c+Ibi8kgYg1WJfN5V+TXYkbYkC71FZud8Mgb1lbrrhLT+Y4wGwJ+KQU9Rs9ap uBig== X-Gm-Message-State: ALyK8tJJ1saVNHZTvT08rI8W2qbsiKDogx8pyqdrwlGMKEoUlYUcT5stHUzG/h/6iFLVcTv/gws= X-Received: by 10.202.108.19 with SMTP id h19mr4185963oic.69.1464219436978; Wed, 25 May 2016 16:37:16 -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 l65sm5103562otc.28.2016.05.25.16.37.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 16:37:16 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 25 May 2016 18:37:00 -0500 Message-Id: <1464219423-14977-8-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464219423-14977-1-git-send-email-bill.fischofer@linaro.org> References: <1464219423-14977-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 07/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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index a8717b7..c6d2026 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -171,7 +171,7 @@ static uint32_t _odp_internal_ilog2(uint64_t value) if (value == pwr_of_2) return bit_shift; else if (value < pwr_of_2) - return bit_shift - 1; + return (uint32_t)((int32_t)bit_shift - 1); } return 64;