Fix tmp[] filling loop so that size == sizeof(tmp) also functions
correctly.
Spotted-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
if (size >= sizeof(tmp)) {
int i;
- for (i = 0; (i + sizeof(tmp)) < size; i += sizeof(tmp))
+ for (i = 0; (i + sizeof(tmp)) <= size; i += sizeof(tmp))
if (copy_to_user(buf + i, tmp, sizeof(tmp)))
return -EFAULT;
return i;