gpu: pvr: fix pdumpfs_stream_buffer_clear
authorLuc Verhaegen <libv@codethink.co.uk>
Fri, 1 Apr 2011 11:50:10 +0000 (13:50 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:05 +0000 (21:43 +0300)
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>
pvr/pvr_pdumpfs.c

index 6050fd3..c1b7df5 100644 (file)
@@ -786,7 +786,7 @@ pdumpfs_stream_buffer_clear(char __user *buf, size_t size)
        if (size >= sizeof(tmp)) {
                int i;
 
        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;
                        if (copy_to_user(buf + i, tmp, sizeof(tmp)))
                                return -EFAULT;
                return i;