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: <5ad8948b-4262-37d5-316d-f9c5f37f1e09@oracle.com>
Date:   Mon, 8 May 2017 16:27:14 -0700
From:   Girish Moodalbail <girish.moodalbail@...cle.com>
To:     David Miller <davem@...emloft.net>, karim.eshapa@...il.com
Cc:     inaky.perez-gonzalez@...el.com, linux-wimax@...el.com,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: net: wimax: i2400m: i2400m-usb: Use time_after
 for time comparison

On 5/8/17 2:26 PM, David Miller wrote:
> From: Karim Eshapa <karim.eshapa@...il.com>
> Date: Mon,  8 May 2017 18:58:02 +0200
>
>> diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h
>> index 649ecad..6fc941c 100644
>> --- a/drivers/net/wimax/i2400m/i2400m-usb.h
>> +++ b/drivers/net/wimax/i2400m/i2400m-usb.h
>> @@ -131,7 +131,7 @@ static inline int edc_inc(struct edc *edc, u16 max_err, u16 timeframe)
>>  	unsigned long now;
>>
>>  	now = jiffies;
>> -	if (now - edc->timestart > timeframe) {
>> +	if (time_after(now - edc->timestart, (unsigned long)timeframe)) {
>
> This is far from correct.
>
> time_after() compares two "jiffies" timestamp values.  The second
> argument here is not a jiffies timestamp value.
>

Perhaps, what is needed here is:

+	if (time_after(jiffies, edc->timestart + timeframe)) {

where in 'timeframe' is set in HZ in all the callers I checked (for the most 
part it is set to EDC_ERROR_TIMEFRAME which is 1HZ).

~Girish

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ