media: dvb_frontend: fix wrong cast in compat_ioctl
authorKatsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Wed, 4 Apr 2018 08:17:56 +0000 (04:17 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 4 Apr 2018 10:27:28 +0000 (06:27 -0400)
FE_GET_PROPERTY has always failed as following situations:
  - Use compatible ioctl
  - The array of 'struct dtv_property' has 2 or more items

This patch fixes wrong cast to a pointer 'struct dtv_property' from a
pointer of 2nd or after item of 'struct compat_dtv_property' array.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-core/dvb_frontend.c

index 21a7d4b..e334149 100644 (file)
@@ -2089,7 +2089,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd,
                }
                for (i = 0; i < tvps->num; i++) {
                        err = dtv_property_process_get(
-                           fe, &getp, (struct dtv_property *)tvp + i, file);
+                           fe, &getp, (struct dtv_property *)(tvp + i), file);
                        if (err < 0) {
                                kfree(tvp);
                                return err;