From patchwork Tue Jun 17 10:07:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 4365661 Return-Path: X-Original-To: patchwork-linux-wireless@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 82733BEEAA for ; Tue, 17 Jun 2014 10:07:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF32220204 for ; Tue, 17 Jun 2014 10:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83448201D5 for ; Tue, 17 Jun 2014 10:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752233AbaFQKHN (ORCPT ); Tue, 17 Jun 2014 06:07:13 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:37686 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbaFQKHM (ORCPT ); Tue, 17 Jun 2014 06:07:12 -0400 Received: by mail-we0-f180.google.com with SMTP id x48so6848621wes.25 for ; Tue, 17 Jun 2014 03:07:11 -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=8zGpuL1Y/qZTSZdql/uAe5ey175gaWlMR6oAHCfA/ys=; b=PGYYH7qQyMdbsNqOx9VNWG12cNiK+5aNS5m0EVgdtsOjF4bG4Z1SOyShp9HekgWMsU vQRyGszAEqIVNrkHZeJ70QnXaf/hOB8dgPHUFiFvh0zHWSgvW3q5XxtR83dPYC0ShqA2 GrR31UbnIG5E/FgPdUa4D0yB0MkN9lTz2bF7Y75e/n1tXg8W5SYHRcHOZLDq4QuynbkC GzSajtIBuRFQNumC0dT18aFMars7iIURwpMRbpjmtmVd90xfjvF3BjjQA8jlZsVznhpR 79V2RYdsoooYpKL/MICW+SQJwE6gZqa3Jhk/9vMYKQ4l9Ei1DOYb58JHsILZFGx42Jur a0EA== X-Gm-Message-State: ALoCoQlE+Gv8ndMGA8AThcNPm9EkC49p+3u36isVv9b5A0Vi1rt8tj7RtzzUsG0WGdcN2fktCg0Z X-Received: by 10.194.57.132 with SMTP id i4mr22189726wjq.6.1402999630943; Tue, 17 Jun 2014 03:07:10 -0700 (PDT) Received: from muse.amr.corp.intel.com (93-172-141-94.bb.netvision.net.il. [93.172.141.94]) by mx.google.com with ESMTPSA id cy4sm19332462wib.5.2014.06.17.03.07.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jun 2014 03:07:10 -0700 (PDT) From: Eliad Peller To: Johannes Berg Cc: Subject: [PATCH] cfg80211: fix elapsed_jiffies calculation Date: Tue, 17 Jun 2014 13:07:02 +0300 Message-Id: <1402999622-27880-1-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466.dirty Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 MAX_JIFFY_OFFSET has no meaning when calculating the elapsed jiffies, as jiffies run out until ULONG_MAX. This miscalculation results in erroneous values in case of a wrap-around. Signed-off-by: Eliad Peller --- since this function is currently used only for returning values to userspace (e.g. time in current dfs state), it's probably not needed for stable. net/wireless/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/core.h b/net/wireless/core.h index 402a653..c43b0ce 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -418,7 +418,7 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start) if (end >= start) return jiffies_to_msecs(end - start); - return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1); + return jiffies_to_msecs(end + (ULONG_MAX - start) + 1); } void