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]
Date:	Fri, 15 Jul 2016 14:49:58 +0200
From:	Bartosz Golaszewski <bgolaszewski@...libre.com>
To:	Wolfram Sang <wsa@...-dreams.de>
Cc:	linux-i2c <linux-i2c@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Lunn <andrew@...n.ch>,
	Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
	Maxime Ripard <maxime.ripard@...e-electrons.com>,
	GregKH <greg@...ah.com>
Subject: Re: [RESEND PATCH 05/14] eeprom: at24: hide the read/write loop
 behind a macro

2016-07-15 14:24 GMT+02:00 Wolfram Sang <wsa@...-dreams.de>:
>> +/*
>> + * Both reads and writes fail if the previous write didn't complete yet. This
>> + * macro loops a few times waiting at least long enough for one entire page
>> + * write to work.
>> + *
>> + * It takes two parameters: a variable in which the future timeout in jiffies
>> + * will be stored and a temporary variable holding the time of the last
>> + * iteration of processing the request. Both should be unsigned integers
>> + * holding at least 32 bits.
>> + */
>> +#define loop_until_timeout(tout, op_time)                            \
>> +     for (tout = jiffies + msecs_to_jiffies(write_timeout),          \
>> +             op_time = jiffies;                                      \
>> +          time_before(op_time, tout);                                \
>> +          usleep_range(1000, 1500), op_time = jiffies)
>
> There is one subtle change coming with this change: the do-while loop is
> guaranteed to run at least once while the for-loop doesn't.
>

While it's technically possible, it will never happen as long as
write_timeout is set to some sensible value.

Thanks,
Bartosz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ