Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735639 > unrolled thread

[PATCH v3 1/2] staging: ion: simplify ioctl args checking function

Started byBenjamin Gaignard <benjamin.gaignard@linaro.org>
First post2017-09-20 10:50 +0200
Last post2017-09-20 10:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/2] staging: ion: simplify ioctl args checking function Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2017-09-20 10:50 +0200

#1735639 — [PATCH v3 1/2] staging: ion: simplify ioctl args checking function

FromBenjamin Gaignard <benjamin.gaignard@linaro.org>
Date2017-09-20 10:50 +0200
Subject[PATCH v3 1/2] staging: ion: simplify ioctl args checking function
Message-ID<urIRH-Bk-15@gated-at.bofh.it>
Make arguments checking more easy to read.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
 drivers/staging/android/ion/ion-ioctl.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index d9f8b14..e26b786 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -27,19 +27,18 @@ union ion_ioctl_arg {
 
 static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
 {
-	int ret = 0;
-
 	switch (cmd) {
 	case ION_IOC_HEAP_QUERY:
-		ret = arg->query.reserved0 != 0;
-		ret |= arg->query.reserved1 != 0;
-		ret |= arg->query.reserved2 != 0;
+		if (arg->query.reserved0 ||
+		    arg->query.reserved1 ||
+		    arg->query.reserved2 )
+			return -EINVAL;
 		break;
 	default:
 		break;
 	}
 
-	return ret ? -EINVAL : 0;
+	return 0;
 }
 
 /* fix up the cases where the ioctl direction bits are incorrect */
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web