Skip to content

Commit

Permalink
s390/appldata: make copy_from_user() invocations provably correct
Browse files Browse the repository at this point in the history
Just change the type of "len" to unsigned int so the compiler can prove
that we don't have a buffer overflow (and generates less code).
We get rid of these:

In function 'copy_from_user',
    inlined from 'appldata_interval_handler' at
    arch/s390/appldata/appldata_base.c:265:
      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 'appldata_timer_handler' at
    arch/s390/appldata/appldata_base.c:225:
      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 'appldata_generic_handler' at
    arch/s390/appldata/appldata_base.c:333:
      uaccess.h:303: warning: call to 'copy_from_user_overflow' declared
      with attribute warning: copy_from_user() buffer size is not provably
      correct

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Oct 24, 2013
1 parent 041058a commit 57f47ba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/s390/appldata/appldata_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static int
appldata_timer_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int len;
unsigned int len;
char buf[2];

if (!*lenp || *ppos) {
Expand Down Expand Up @@ -246,7 +246,8 @@ static int
appldata_interval_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int len, interval;
unsigned int len;
int interval;
char buf[16];

if (!*lenp || *ppos) {
Expand Down Expand Up @@ -290,7 +291,8 @@ appldata_generic_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct appldata_ops *ops = NULL, *tmp_ops;
int rc, len, found;
unsigned int len;
int rc, found;
char buf[2];
struct list_head *lh;

Expand Down

0 comments on commit 57f47ba

Please sign in to comment.