diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-26 05:59:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-26 06:58:47 -0400 |
commit | f8a695c4b43d02c89b8bba9ba6058fd5db1bc71d (patch) | |
tree | 7334615c97868decbfb413a9391c3062812020ad | |
parent | 6ccd228e0cfce2a4f44558422d25c60fcb1a6710 (diff) |
media: v4l2-ioctl: rename a temp var that stores _IOC_SIZE(cmd)
Instead of just calling it as "size", let's name it as "ioc_size",
as it reflects better its contents.
As this is constant along the function, also mark it as const.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ioctl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index a5dab16ff2d2..f48c505550e0 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
@@ -2833,15 +2833,15 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | |||
2833 | size_t array_size = 0; | 2833 | size_t array_size = 0; |
2834 | void __user *user_ptr = NULL; | 2834 | void __user *user_ptr = NULL; |
2835 | void **kernel_ptr = NULL; | 2835 | void **kernel_ptr = NULL; |
2836 | size_t size = _IOC_SIZE(cmd); | 2836 | const size_t ioc_size = _IOC_SIZE(cmd); |
2837 | 2837 | ||
2838 | /* Copy arguments into temp kernel buffer */ | 2838 | /* Copy arguments into temp kernel buffer */ |
2839 | if (_IOC_DIR(cmd) != _IOC_NONE) { | 2839 | if (_IOC_DIR(cmd) != _IOC_NONE) { |
2840 | if (size <= sizeof(sbuf)) { | 2840 | if (ioc_size <= sizeof(sbuf)) { |
2841 | parg = sbuf; | 2841 | parg = sbuf; |
2842 | } else { | 2842 | } else { |
2843 | /* too big to allocate from stack */ | 2843 | /* too big to allocate from stack */ |
2844 | mbuf = kvmalloc(size, GFP_KERNEL); | 2844 | mbuf = kvmalloc(ioc_size, GFP_KERNEL); |
2845 | if (NULL == mbuf) | 2845 | if (NULL == mbuf) |
2846 | return -ENOMEM; | 2846 | return -ENOMEM; |
2847 | parg = mbuf; | 2847 | parg = mbuf; |
@@ -2849,7 +2849,7 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | |||
2849 | 2849 | ||
2850 | err = -EFAULT; | 2850 | err = -EFAULT; |
2851 | if (_IOC_DIR(cmd) & _IOC_WRITE) { | 2851 | if (_IOC_DIR(cmd) & _IOC_WRITE) { |
2852 | unsigned int n = size; | 2852 | unsigned int n = ioc_size; |
2853 | 2853 | ||
2854 | /* | 2854 | /* |
2855 | * In some cases, only a few fields are used as input, | 2855 | * In some cases, only a few fields are used as input, |
@@ -2870,11 +2870,11 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | |||
2870 | goto out; | 2870 | goto out; |
2871 | 2871 | ||
2872 | /* zero out anything we don't copy from userspace */ | 2872 | /* zero out anything we don't copy from userspace */ |
2873 | if (n < size) | 2873 | if (n < ioc_size) |
2874 | memset((u8 *)parg + n, 0, size - n); | 2874 | memset((u8 *)parg + n, 0, ioc_size - n); |
2875 | } else { | 2875 | } else { |
2876 | /* read-only ioctl */ | 2876 | /* read-only ioctl */ |
2877 | memset(parg, 0, size); | 2877 | memset(parg, 0, ioc_size); |
2878 | } | 2878 | } |
2879 | } | 2879 | } |
2880 | 2880 | ||
@@ -2932,7 +2932,7 @@ out_array_args: | |||
2932 | switch (_IOC_DIR(cmd)) { | 2932 | switch (_IOC_DIR(cmd)) { |
2933 | case _IOC_READ: | 2933 | case _IOC_READ: |
2934 | case (_IOC_WRITE | _IOC_READ): | 2934 | case (_IOC_WRITE | _IOC_READ): |
2935 | if (copy_to_user((void __user *)arg, parg, size)) | 2935 | if (copy_to_user((void __user *)arg, parg, ioc_size)) |
2936 | err = -EFAULT; | 2936 | err = -EFAULT; |
2937 | break; | 2937 | break; |
2938 | } | 2938 | } |