From patchwork Thu May 26 15:14:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 68704 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp461390qge; Thu, 26 May 2016 08:20:35 -0700 (PDT) X-Received: by 10.55.21.65 with SMTP id f62mr1187324qkh.109.1464276035780; Thu, 26 May 2016 08:20:35 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c15si13380610qta.62.2016.05.26.08.20.35; Thu, 26 May 2016 08:20:35 -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 541F4617DC; Thu, 26 May 2016 15:20:35 +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 9A0C36180F; Thu, 26 May 2016 15:16:56 +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 2FA5B617DD; Thu, 26 May 2016 15:16:42 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.linaro.org (Postfix) with ESMTPS id 5F19C617E6 for ; Thu, 26 May 2016 15:14:55 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id j1so128953535oih.3 for ; Thu, 26 May 2016 08:14:55 -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=KKLTetqoS2IqTr6GCjoyAIaSGimoVrMq9MKrU3tTssOB1iYUMhRc24s8qM97iGzpR6 czxB5G7HEQycbfp1Fhl8AcLtUt0wNvo2+DAtPp41MlZAsjbMdG73UrDGxlLxq7/qkicx kfVLofkFOyo6F+Ku6xF8uon7A+4KaZnZqVgF39phv9lKU2PwjBxYhzTaWPXdjpcdkAg0 XfzqQkOvFXt7OvcGVt8/v4Um0xe8Wwn3dod+aUgp2lZOLCoVDzsFAh9328iCTlUfbpvs 6h+pSxvgdNyzRsWJOxV9jTJDZnqsntjIiFToGf2TwWKket06BiXC+OqPGEefoT33YRgM 53gw== X-Gm-Message-State: ALyK8tLRP6hqPnB2brLx4rJC7u7VaFroO9BX2ZJVR61zUaL2bhaYa0RogrgpwopSxBpc7jJasYM= X-Received: by 10.202.89.68 with SMTP id n65mr5814220oib.138.1464275694841; Thu, 26 May 2016 08:14:54 -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 60sm6646041ott.13.2016.05.26.08.14.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 May 2016 08:14:54 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 26 May 2016 10:14:42 -0500 Message-Id: <1464275685-18426-8-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464275685-18426-1-git-send-email-bill.fischofer@linaro.org> References: <1464275685-18426-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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;