Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1735425ybl; Thu, 30 Jan 2020 05:11:27 -0800 (PST) X-Google-Smtp-Source: APXvYqx7GeclZUzOmh1n1MY58HHz8Ggok1+PZVI3OaL2LH9mEeFTICGMMsqmolJv4ccokJvMP7hP X-Received: by 2002:aca:b2c5:: with SMTP id b188mr2786576oif.163.1580389887519; Thu, 30 Jan 2020 05:11:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580389887; cv=none; d=google.com; s=arc-20160816; b=qpRKHdIRpryF1egsmyvjdRSVSmduGm3YHy/LCanQNmnDNBKhQuwdhPA/982eurwZQU wvLKPI7/cdAL8a2l8takOLqKtKuKQPBRlYbxcuxVmSLmwU5iaRlCx9UYbpkxghBL6heW rKsBRpfiIueA4+Aw+mLAZzbMoU0ykzVTMRuNruaw509xmD81iyt9EeXzGvoHE4BrWrXa Ql62Aw8x9Aj3uI8PgZETiywWAtuxUBVxAd0a+VatsaG+xwZ1HXj9w2WH7yzXgm9urIsP myVnIqjTFmAZQklCsD56IBM7ZAivqElTmes8CZfNvkysUJXy3AR0n/NTAhr7lalZIcPB SBjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=5Z1uZ4dLYpPMqp5/COT3BE5UVDDAiEoPaZTiono2bQg=; b=JgLMdjuswXVWhfDdgWXE+zx7I56JGt75V6vod28O5h0mnOVeX2JncXgv4aRyNA1kmS o3cFDPb8r9NAVu5M7HiotTbwHo62gmYsNXL2CftqTVrvPljnJkWFFzI/PiUID/yxAN6g okKLotpVqpfA1FO0DX2uPvRMOK5iTgMhwhW9eqImAIMrkvlAY9WXNESw1wMCevspIr+i /gYy3flFx0ibpj/y0WjPkm4JbzrUHkoY5IfVVvKznKph/O11X4okuGKuIZEjkRoEPmqI FFs+XnExjuPl/lN9PwrrcrmbuGc0qOQhb/kcYd3PJLuxfMeL2gSZlb6avPQwaZPUHzTC 4TEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si2999118otp.5.2020.01.30.05.11.13; Thu, 30 Jan 2020 05:11:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727247AbgA3NJC (ORCPT + 99 others); Thu, 30 Jan 2020 08:09:02 -0500 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:8274 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgA3NJC (ORCPT ); Thu, 30 Jan 2020 08:09:02 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04397;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0TomMfq-_1580389734; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TomMfq-_1580389734) by smtp.aliyun-inc.com(127.0.0.1); Thu, 30 Jan 2020 21:09:00 +0800 From: Wen Yang To: Thomas Gleixner Cc: Wen Yang , linux-kernel@vger.kernel.org Subject: [PATCH] hrtimer: fix an explicit cast in __ktime_divns() Date: Thu, 30 Jan 2020 21:08:51 +0800 Message-Id: <20200130130851.29204-1-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_div() does a 64-by-32 division, while the divisor 'div' is explicitly casted to unsigned long, thus 64-bit on 64-bit platforms. In addition, the above lines also ensures that the divisor is less than 2^32. Hence the proper cast type is u32. Signed-off-by: Wen Yang Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org --- kernel/time/hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index d8b62f93fc8d..57e543860660 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -311,7 +311,7 @@ s64 __ktime_divns(const ktime_t kt, s64 div) div >>= 1; } tmp >>= sft; - do_div(tmp, (unsigned long) div); + do_div(tmp, (u32) div); return dclc < 0 ? -tmp : tmp; } EXPORT_SYMBOL_GPL(__ktime_divns); -- 2.23.0