Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
57f47ba0 041058a1

+5 -3
+5 -3
arch/s390/appldata/appldata_base.c
··· 204 204 appldata_timer_handler(ctl_table *ctl, int write, 205 205 void __user *buffer, size_t *lenp, loff_t *ppos) 206 206 { 207 - int len; 207 + unsigned int len; 208 208 char buf[2]; 209 209 210 210 if (!*lenp || *ppos) { ··· 246 246 appldata_interval_handler(ctl_table *ctl, int write, 247 247 void __user *buffer, size_t *lenp, loff_t *ppos) 248 248 { 249 - int len, interval; 249 + unsigned int len; 250 + int interval; 250 251 char buf[16]; 251 252 252 253 if (!*lenp || *ppos) { ··· 291 290 void __user *buffer, size_t *lenp, loff_t *ppos) 292 291 { 293 292 struct appldata_ops *ops = NULL, *tmp_ops; 294 - int rc, len, found; 293 + unsigned int len; 294 + int rc, found; 295 295 char buf[2]; 296 296 struct list_head *lh; 297 297