提交 57f47ba0 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

s390/appldata: make copy_from_user() invocations provably correct

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: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 041058a1
...@@ -204,7 +204,7 @@ static int ...@@ -204,7 +204,7 @@ static int
appldata_timer_handler(ctl_table *ctl, int write, appldata_timer_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int len; unsigned int len;
char buf[2]; char buf[2];
if (!*lenp || *ppos) { if (!*lenp || *ppos) {
...@@ -246,7 +246,8 @@ static int ...@@ -246,7 +246,8 @@ static int
appldata_interval_handler(ctl_table *ctl, int write, appldata_interval_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int len, interval; unsigned int len;
int interval;
char buf[16]; char buf[16];
if (!*lenp || *ppos) { if (!*lenp || *ppos) {
...@@ -290,7 +291,8 @@ appldata_generic_handler(ctl_table *ctl, int write, ...@@ -290,7 +291,8 @@ appldata_generic_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
struct appldata_ops *ops = NULL, *tmp_ops; struct appldata_ops *ops = NULL, *tmp_ops;
int rc, len, found; unsigned int len;
int rc, found;
char buf[2]; char buf[2];
struct list_head *lh; struct list_head *lh;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册