While testing on newer kernels lov_obd.c failes to compile
with the following warning.
In function copy_to_user,
inlined from lov_iocontrol at
lustre-2.7.52/lustre/lov/lov_obd.c:1168:
./arch/x86/include/asm/uaccess.h:735: error: call to
__copy_to_user_overflow declared with attribute warning:
copy_to_user() buffer size is not probably correct
In lov_iocontrol the data was being casted to int instead
of the required unsigned long. This patch changes the cast
to what is needed for copy_to_user.
Change-Id: I75b9f4f935d57dc3df56a2c0869c7d2506217d39
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/14613
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
/* copy UUID */
if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
/* copy UUID */
if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
- min((int)data->ioc_plen2,
- (int)sizeof(struct obd_uuid))))
- RETURN(-EFAULT);
+ min_t(unsigned long, data->ioc_plen2,
+ sizeof(struct obd_uuid))))
+ RETURN(-EFAULT);
flags = uarg ? *(__u32 __user *)uarg : 0;
/* got statfs data */
flags = uarg ? *(__u32 __user *)uarg : 0;
/* got statfs data */
if (rc)
RETURN(rc);
if (copy_to_user(data->ioc_pbuf1, &stat_buf,
if (rc)
RETURN(rc);
if (copy_to_user(data->ioc_pbuf1, &stat_buf,
- min((int) data->ioc_plen1,
- (int) sizeof(stat_buf))))
- RETURN(-EFAULT);
- break;
+ min_t(unsigned long, data->ioc_plen1,
+ sizeof(struct obd_statfs))))
+ RETURN(-EFAULT);
+ break;
}
case OBD_IOC_LOV_GET_CONFIG: {
struct obd_ioctl_data *data;
}
case OBD_IOC_LOV_GET_CONFIG: {
struct obd_ioctl_data *data;