From 65ca9cf76c23b23be40fb409925dfe9a26591f94 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Fri, 9 Jun 2017 22:53:47 +0900 Subject: [PATCH] [COMMON] staging: android: ion_test: fix copying incorrect size to userspace ion_test_ioctl() copies the data to userspace if ioctl command includes read property. But it copies incorrect number of bytes because 'data' in sizeof(data) is union of various length data structures. Change-Id: I3bcafa6823a38b8ce949f90086dbc9f4c5d3e8c3 Signed-off-by: Cho KyongHo --- drivers/staging/android/ion/ion_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c index 5abf8320a96a..05673eb46de2 100644 --- a/drivers/staging/android/ion/ion_test.c +++ b/drivers/staging/android/ion/ion_test.c @@ -200,7 +200,7 @@ static long ion_test_ioctl(struct file *filp, unsigned int cmd, } if (_IOC_DIR(cmd) & _IOC_READ) { - if (copy_to_user((void __user *)arg, &data, sizeof(data))) + if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) return -EFAULT; } return ret; -- 2.20.1