From: "Stephen Biggs" Subject: [KJ] [PATCH][RESUBMIT][7/21] drivers/isdn/pcbit/* - compile warning cleanup compile warning cleanup - handle copy_to/from_user error returns Signed-off-by: Stephen Biggs Signed-off-by: Domen Puncer --- drv.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) Index: quilt/drivers/isdn/pcbit/drv.c =================================================================== --- quilt.orig/drivers/isdn/pcbit/drv.c +++ quilt/drivers/isdn/pcbit/drv.c @@ -727,23 +727,26 @@ static int pcbit_stat(u_char __user *buf 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;