[PATCH] staging: lustre: return error if copy_to_user fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <hgujulan@xxxxxxxxxxx>
---
 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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux