Commit 7d870d93 authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: lov: copy_to_user uses wrong casting

With certain version of gcc lov_obd.c failes to compile
with the following warning.

In function copy_to_user,
inlined from lov_iocontrol at
lustre/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.
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6302
Reviewed-on: http://review.whamcloud.com/14613Reviewed-by: default avatarfrank zago <fzago@cray.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7d5215d
...@@ -1085,8 +1085,8 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, ...@@ -1085,8 +1085,8 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
/* copy UUID */ /* copy UUID */
if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd), if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
min((int)data->ioc_plen2, min_t(unsigned long, data->ioc_plen2,
(int)sizeof(struct obd_uuid)))) sizeof(struct obd_uuid))))
return -EFAULT; return -EFAULT;
memcpy(&flags, data->ioc_inlbuf1, sizeof(__u32)); memcpy(&flags, data->ioc_inlbuf1, sizeof(__u32));
...@@ -1099,8 +1099,8 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, ...@@ -1099,8 +1099,8 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
if (rc) if (rc)
return rc; return rc;
if (copy_to_user(data->ioc_pbuf1, &stat_buf, if (copy_to_user(data->ioc_pbuf1, &stat_buf,
min((int)data->ioc_plen1, min_t(unsigned long, data->ioc_plen1,
(int)sizeof(stat_buf)))) sizeof(stat_buf))))
return -EFAULT; return -EFAULT;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment