The return value of copy_to_user() isn't checked for failure.Hence
return -EFAULT if it fails.

Signed-off-by: Hari Prasath Gujulan Elango <hguju...@visteon.com>
---
 drivers/staging/lustre/lustre/lov/lov_pack.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c 
b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 5356d53..aa3d6de 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -448,9 +448,10 @@ int lov_getstripe(struct obd_export *exp, struct 
lov_stripe_md *lsm,
            (lum.lmm_stripe_count < lsm->lsm_stripe_count)) {
                /* Return right size of stripe to user */
                lum.lmm_stripe_count = lsm->lsm_stripe_count;
-               rc = copy_to_user(lump, &lum, lum_size);
-               rc = -EOVERFLOW;
-               goto out_set;
+               if (copy_to_user(lump, &lum, lum_size)) {
+                       rc = -EFAULT;
+                       goto out_set;
+               }
        }
        rc = lov_packmd(exp, &lmmk, lsm);
        if (rc < 0)
-- 
1.9.1
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to