From patchwork Mon Sep 16 22:43:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 2899851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0DAA8BFF05 for ; Mon, 16 Sep 2013 22:44:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 453E72017C for ; Mon, 16 Sep 2013 22:44:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6011A20177 for ; Mon, 16 Sep 2013 22:44:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhX0-0001sS-0L; Mon, 16 Sep 2013 22:44:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhWs-0002RB-FK; Mon, 16 Sep 2013 22:44:26 +0000 Received: from mail-pd0-f176.google.com ([209.85.192.176]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VLhWh-0002OB-LI for linux-arm-kernel@lists.infradead.org; Mon, 16 Sep 2013 22:44:16 +0000 Received: by mail-pd0-f176.google.com with SMTP id q10so4676023pdj.7 for ; Mon, 16 Sep 2013 15:43:54 -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=1PDyelZkL0DV1PJuvP5JuonjPD9cBKfpl/l4egNXN0Q=; b=SaQORargjmYX5GXb2Y7FxjY2pHAy6AfD56nDfOslMaVICmzqPIj+wx73IbYHFfjXxw bMIV/HifWx833fieeOwgb8zW/44MmnqPR4Z51W7eMcEXoYxua9g1K915BTAdDSqvMxiz aQVt66UEl8Y9S9ddihswF7aTizO/8v6GJeMjIc9fqO42N0os5mOiedBkpezJs5JwG8M9 rK44n6ks/JsGZqS847BqOzod1xwKIxbBiIulYLheCHVpLi8P1iQvKMG9jNpR7xmc1MEM 76l4bVfo8Y453gP3JkXXTkylYcykQAeUHzP5931QKTtRzxGGrb94EAtDrm2NNiQca4MF Ewvg== X-Gm-Message-State: ALoCoQkX3LTK1LwtF5OyH/chqBtfjfiZzEYz6Yv2pszbSOAc5re/wqkzKflED42HfqCErXzJC5Sj X-Received: by 10.66.155.36 with SMTP id vt4mr33157912pab.93.1379371434432; Mon, 16 Sep 2013 15:43:54 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPSA id gg10sm33613804pbc.46.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 16 Sep 2013 15:43:53 -0700 (PDT) From: Kevin Hilman To: Frederic Weisbecker Subject: [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment() Date: Mon, 16 Sep 2013 15:43:49 -0700 Message-Id: <1379371429-22214-2-git-send-email-khilman@linaro.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1379371429-22214-1-git-send-email-khilman@linaro.org> References: <1379371429-22214-1-git-send-email-khilman@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130916_184415_828824_7E5E8CF9 X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -1.9 (-) Cc: Paul McKenney , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The conversion of the max deferment from usecs to nsecs can easily overflow on platforms where a long is 32-bits. To fix, cast the usecs value to u64 before multiplying by NSECS_PER_USEC. This was discovered on 32-bit ARM platform when extending the max deferment value. Cc: Frederic Weisbecker Signed-off-by: Kevin Hilman --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4b1fe3e..3d7c80e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2203,7 +2203,7 @@ u64 scheduler_tick_max_deferment(void) if (time_before_eq(next, now)) return 0; - return jiffies_to_usecs(next - now) * NSEC_PER_USEC; + return (u64)jiffies_to_usecs(next - now) * NSEC_PER_USEC; } static __init int sched_nohz_full_init_debug(void)