[patch 8/8] drivers/isdn/pcbit/* - compile warning cleanup

From: domen
Date: Sun Mar 06 2005 - 18:21:26 EST



compile warning cleanup - handle copy_to/from_user error
returns

Signed-off-by: Stephen Biggs <yrgrknmxpzlk@xxxxxxxxx>
Signed-off-by: Domen Puncer <domen@xxxxxxxxxxxx>
---


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;

_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/