]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: lustre: uapi: move obd_ioctl_is_invalid() to linux-module.c
authorJames Simmons <jsimmons@infradead.org>
Sun, 20 Aug 2017 02:26:05 +0000 (22:26 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Aug 2017 01:36:47 +0000 (18:36 -0700)
The inline function obd_ioctl_is_invalid() is no longer needed by
userland and also the function was pretty bug for a inline function.
Since this is the case we can move this kernel only code to the
linux-module.c which is the only place it is used.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: https://review.whamcloud.com/24568
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre/lustre_ioctl.h
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c

index 914cea1e2d5de5d5869029ea2a5ab73b9a8f42af..85853025a171991d06c65153fe0fb7450bf1c47f 100644 (file)
@@ -132,82 +132,6 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
        return len;
 }
 
-static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
-{
-       if (data->ioc_len > (1 << 30)) {
-               CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
-               return 1;
-       }
-
-       if (data->ioc_inllen1 > (1 << 30)) {
-               CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
-               return 1;
-       }
-
-       if (data->ioc_inllen2 > (1 << 30)) {
-               CERROR("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
-               return 1;
-       }
-
-       if (data->ioc_inllen3 > (1 << 30)) {
-               CERROR("OBD ioctl: ioc_inllen3 larger than 1<<30\n");
-               return 1;
-       }
-
-       if (data->ioc_inllen4 > (1 << 30)) {
-               CERROR("OBD ioctl: ioc_inllen4 larger than 1<<30\n");
-               return 1;
-       }
-
-       if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
-               CERROR("OBD ioctl: inlbuf1 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
-               CERROR("OBD ioctl: inlbuf2 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (data->ioc_inlbuf3 && !data->ioc_inllen3) {
-               CERROR("OBD ioctl: inlbuf3 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (data->ioc_inlbuf4 && !data->ioc_inllen4) {
-               CERROR("OBD ioctl: inlbuf4 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (data->ioc_pbuf1 && !data->ioc_plen1) {
-               CERROR("OBD ioctl: pbuf1 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (data->ioc_pbuf2 && !data->ioc_plen2) {
-               CERROR("OBD ioctl: pbuf2 pointer but 0 length\n");
-               return 1;
-       }
-
-       if (!data->ioc_pbuf1 && data->ioc_plen1) {
-               CERROR("OBD ioctl: plen1 set but NULL pointer\n");
-               return 1;
-       }
-
-       if (!data->ioc_pbuf2 && data->ioc_plen2) {
-               CERROR("OBD ioctl: plen2 set but NULL pointer\n");
-               return 1;
-       }
-
-       if (obd_ioctl_packlen(data) > data->ioc_len) {
-               CERROR("OBD ioctl: packlen exceeds ioc_len (%d > %d)\n",
-                      obd_ioctl_packlen(data), data->ioc_len);
-               return 1;
-       }
-
-       return 0;
-}
-
 /*
  * OBD_IOC_DATA_TYPE is only for compatibility reasons with older
  * Linux Lustre user tools. New ioctls should NOT use this macro as
index 3a394d21a6f4b33116ccdfe5c1487b35e56e54ca..092e68af749afc9ac4086b67b723eddec13c44c6 100644 (file)
 #include "../../include/lustre/lustre_ioctl.h"
 #include "../../include/lustre_ver.h"
 
+static int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
+{
+       if (data->ioc_len > BIT(30)) {
+               CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
+               return 1;
+       }
+
+       if (data->ioc_inllen1 > BIT(30)) {
+               CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
+               return 1;
+       }
+
+       if (data->ioc_inllen2 > BIT(30)) {
+               CERROR("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
+               return 1;
+       }
+
+       if (data->ioc_inllen3 > BIT(30)) {
+               CERROR("OBD ioctl: ioc_inllen3 larger than 1<<30\n");
+               return 1;
+       }
+
+       if (data->ioc_inllen4 > BIT(30)) {
+               CERROR("OBD ioctl: ioc_inllen4 larger than 1<<30\n");
+               return 1;
+       }
+
+       if (data->ioc_inlbuf1 && data->ioc_inllen1 == 0) {
+               CERROR("OBD ioctl: inlbuf1 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (data->ioc_inlbuf2 && data->ioc_inllen2 == 0) {
+               CERROR("OBD ioctl: inlbuf2 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (data->ioc_inlbuf3 && data->ioc_inllen3 == 0) {
+               CERROR("OBD ioctl: inlbuf3 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (data->ioc_inlbuf4 && data->ioc_inllen4 == 0) {
+               CERROR("OBD ioctl: inlbuf4 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (data->ioc_pbuf1 && data->ioc_plen1 == 0) {
+               CERROR("OBD ioctl: pbuf1 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (data->ioc_pbuf2 && data->ioc_plen2 == 0) {
+               CERROR("OBD ioctl: pbuf2 pointer but 0 length\n");
+               return 1;
+       }
+
+       if (!data->ioc_pbuf1 && data->ioc_plen1 != 0) {
+               CERROR("OBD ioctl: plen1 set but NULL pointer\n");
+               return 1;
+       }
+
+       if (!data->ioc_pbuf2 && data->ioc_plen2 != 0) {
+               CERROR("OBD ioctl: plen2 set but NULL pointer\n");
+               return 1;
+       }
+
+       if (obd_ioctl_packlen(data) > data->ioc_len) {
+               CERROR("OBD ioctl: packlen exceeds ioc_len (%d > %d)\n",
+               obd_ioctl_packlen(data), data->ioc_len);
+               return 1;
+       }
+
+       return 0;
+}
+
 /* buffer MUST be at least the size of obd_ioctl_hdr */
 int obd_ioctl_getdata(char **buf, int *len, void __user *arg)
 {