]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
s390/cmm: make copy_from_user() invocation provably correct
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 14 Oct 2013 11:58:10 +0000 (13:58 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 22 Oct 2013 07:18:23 +0000 (09:18 +0200)
Get rid of these two warnings:

In function 'copy_from_user',
    inlined from 'cmm_timeout_handler' at arch/s390/mm/cmm.c:310:
      uaccess.h:303: warning: call to 'copy_from_user_overflow' declared
      with attribute warning: copy_from_user() buffer size is not provably
      correct
In function 'copy_from_user',
    inlined from 'cmm_pages_handler' at arch/s390/mm/cmm.c:270:
      uaccess.h:303: warning: call to 'copy_from_user_overflow' declared
      with attribute warning: copy_from_user() buffer size is not provably
      correct

Change the "len" type to unsigned int, so we can make sure that there is no
buffer overflow. This also generates less code.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/mm/cmm.c

index 9d84a1feefef0e57005f6a31ae50079ebec3a15b..76741306af2a9d5193c4a12c2210d520c26c129f 100644 (file)
@@ -257,8 +257,8 @@ static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer,
                             size_t *lenp, loff_t *ppos)
 {
        char buf[16], *p;
+       unsigned int len;
        long nr;
-       int len;
 
        if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
@@ -298,7 +298,7 @@ static int cmm_timeout_handler(ctl_table *ctl, int write,  void __user *buffer,
 {
        char buf[64], *p;
        long nr, seconds;
-       int len;
+       unsigned int len;
 
        if (!*lenp || (*ppos && !write)) {
                *lenp = 0;