lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1431859498.31486.1.camel@mtksdaap41>
Date:	Sun, 17 May 2015 18:44:58 +0800
From:	Eddie Huang <eddie.huang@...iatek.com>
To:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
CC:	<linux-mediatek@...ts.infradead.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<rtc-linux@...glegroups.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rtc: mt6397: fix build on some 32bits platforms

On Thu, 2015-05-14 at 22:51 +0200, Alexandre Belloni wrote:
> On some !ARM 32bits platforms, the following compilation error happens
> because of the division on a 64bits value in mtk_rtc_read_time():
> 
> drivers/built-in.o: In function `mtk_rtc_read_time':
> rtc-mt6397.c:(.text+0x265d13f): undefined reference to `__divdi3'
> rtc-mt6397.c:(.text+0x265d150): undefined reference to `__moddi3'
> 
> Use div_s64() as done in rtc_time64_to_tm() to solve that.
> 
> Reported-by: kbuild test robot <fengguang.wu@...el.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
> ---
>  drivers/rtc/rtc-mt6397.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index 8bed852e4961..c0090b698ff3 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -150,7 +150,7 @@ static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  {
>  	time64_t time;
>  	struct mt6397_rtc *rtc = dev_get_drvdata(dev);
> -	int sec, ret;
> +	int days, sec, ret;
>  
>  	do {
>  		ret = __mtk_rtc_read_time(rtc, tm, &sec);
> @@ -171,7 +171,8 @@ static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  	/* rtc_tm_to_time64 covert Gregorian date to seconds since
>  	 * 01-01-1970 00:00:00, and this date is Thursday.
>  	 */
> -	tm->tm_wday = (time / 86400 + 4) % 7;
> +	days = div_s64(time, 86400);
> +	tm->tm_wday = (days + 4) % 7;
>  
>  exit:
>  	return ret;

Acked-by: Eddie Huang <eddie.huang@...iatek.com>



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ