staging: lustre: lnet: make sure lnet data not greater than LIBCFS_IOC_DATA_MAX
authorLiang Zhen <liang.zhen@intel.com>
Tue, 22 Mar 2016 23:03:58 +0000 (19:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Fail to compile if largest LNet user land data structures passed
to kernel are larger than LIBCFS_IOC_DATA_MAX

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11313
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/api-ni.c

index 8764755544c98238a46a79dbe344d04fba198973..f825784b79e1ad8c45e007aa30e714ac1c1af4e0 100644 (file)
@@ -1864,6 +1864,10 @@ LNetCtl(unsigned int cmd, void *arg)
        int rc;
        unsigned long secs_passed;
 
+       BUILD_BUG_ON(LIBCFS_IOC_DATA_MAX <
+                    sizeof(struct lnet_ioctl_net_config) +
+                    sizeof(struct lnet_ioctl_config_data));
+
        switch (cmd) {
        case IOC_LIBCFS_GET_NI:
                rc = LNetGetId(data->ioc_count, &id);
This page took 0.038233 seconds and 5 git commands to generate.