2005-03-06 23:17:24

by Domen Puncer

[permalink] [raw]
Subject: [patch 8/8] drivers/isdn/pcbit/* - compile warning cleanup


compile warning cleanup - handle copy_to/from_user error
returns

Signed-off-by: Stephen Biggs <[email protected]>
Signed-off-by: Domen Puncer <[email protected]>
---


kj-domen/drivers/isdn/pcbit/drv.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)

diff -puN drivers/isdn/pcbit/drv.c~return_code-drivers_isdn_pcbit drivers/isdn/pcbit/drv.c
--- kj/drivers/isdn/pcbit/drv.c~return_code-drivers_isdn_pcbit 2005-03-05 16:13:08.000000000 +0100
+++ kj-domen/drivers/isdn/pcbit/drv.c 2005-03-05 16:13:08.000000000 +0100
@@ -727,23 +727,26 @@ int pcbit_stat(u_char __user *buf, int l

if (stat_st < stat_end)
{
- copy_to_user(buf, statbuf + stat_st, len);
+ if (copy_to_user(buf, statbuf + stat_st, len))
+ return -EFAULT;
stat_st += len;
}
else
{
if (len > STATBUF_LEN - stat_st)
{
- copy_to_user(buf, statbuf + stat_st,
- STATBUF_LEN - stat_st);
- copy_to_user(buf, statbuf,
- len - (STATBUF_LEN - stat_st));
+ if (copy_to_user(buf, statbuf + stat_st,
+ STATBUF_LEN - stat_st) ||
+ copy_to_user(buf, statbuf,
+ len - (STATBUF_LEN - stat_st)))
+ return -EFAULT;

stat_st = len - (STATBUF_LEN - stat_st);
}
else
{
- copy_to_user(buf, statbuf + stat_st, len);
+ if (copy_to_user(buf, statbuf + stat_st, len))
+ return -EFAULT;

stat_st += len;

_