[no subject]

2018-02-03 Thread Jones
This is in regards to an inheritance on your surname, reply back using your 
email address, stating your full name for more details. Reply to email for 
info. Email me here ( ger...@dr.com )


cron job: media_tree daily build: ERRORS

2018-02-03 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sun Feb  4 05:00:16 CET 2018
media-tree git hash:273caa260035c03d89ad63d72d8cd3d9e5c5e3f1
media_build git hash:   d17383327f00d45e6c07161876fb4f3d9d9358e1
v4l-utils git hash: ff5ed3c00f84eccbefb73d1b3b85e5dd92734ae3
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: v0.5.0-3911-g6f737e1f
smatch version: v0.5.0-3911-g6f737e1f
host hardware:  x86_64
host os:4.14.0-364

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: ERRORS
linux-3.11.1-i686: ERRORS
linux-3.12.67-i686: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0.9-i686: ERRORS
linux-4.1.33-i686: ERRORS
linux-4.2.8-i686: ERRORS
linux-4.3.6-i686: ERRORS
linux-4.4.22-i686: ERRORS
linux-4.5.7-i686: ERRORS
linux-4.6.7-i686: ERRORS
linux-4.7.5-i686: ERRORS
linux-4.8-i686: ERRORS
linux-4.9.26-i686: ERRORS
linux-4.10.14-i686: WARNINGS
linux-4.11-i686: WARNINGS
linux-4.12.1-i686: WARNINGS
linux-4.13-i686: WARNINGS
linux-4.14-i686: WARNINGS
linux-4.15-i686: WARNINGS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: ERRORS
linux-3.11.1-x86_64: ERRORS
linux-3.12.67-x86_64: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0.9-x86_64: ERRORS
linux-4.1.33-x86_64: ERRORS
linux-4.2.8-x86_64: ERRORS
linux-4.3.6-x86_64: ERRORS
linux-4.4.22-x86_64: ERRORS
linux-4.5.7-x86_64: ERRORS
linux-4.6.7-x86_64: ERRORS
linux-4.7.5-x86_64: ERRORS
linux-4.8-x86_64: ERRORS
linux-4.9.26-x86_64: ERRORS
linux-4.10.14-x86_64: WARNINGS
linux-4.11-x86_64: WARNINGS
linux-4.12.1-x86_64: WARNINGS
linux-4.13-x86_64: WARNINGS
linux-4.14-x86_64: WARNINGS
linux-4.15-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
smatch: OK

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


[PATCH] media-ioc-g-topology.rst: fix interface-to-entity link description

2018-02-03 Thread Hans Verkuil
The source_id and sink_id descriptions were the same for interface-to-entity
links. The source_id is the interface ID, not the entity ID. Fix this.

Signed-off-by: Hans Verkuil 
---
diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst 
b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
index 997e6b17440d..870a6c0d1f7a 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
@@ -334,7 +334,7 @@ desired arrays with the media graph elements.

-  On pad to pad links: unique ID for the source pad.

- On interface to entity links: unique ID for the entity.
+ On interface to entity links: unique ID for the interface.

 -  .. row 3



[PATCH] media-device.c: zero reserved field

2018-02-03 Thread Hans Verkuil
MEDIA_IOC_SETUP_LINK didn't zero the reserved field of the media_link_desc
struct. Do so in media_device_setup_link().

Signed-off-by: Hans Verkuil 
---
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index e79f72b8b858..afbf23a19e16 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -218,6 +218,8 @@ static long media_device_setup_link(struct media_device 
*mdev,
if (link == NULL)
return -EINVAL;

+   memset(linkd->reserved, 0, sizeof(linkd->reserved));
+
/* Setup the link on both entities. */
return __media_entity_setup_link(link, linkd->flags);
 }


[RFC PATCH] media-ioc-enum-entities/links.rst: document reserved fields

2018-02-03 Thread Hans Verkuil
These structures have reserved fields that were never documented.

Signed-off-by: Hans Verkuil 
---
The kernel correctly zeroes these, but should we require that userspace also
does this? I think it may be too late for that, in that case the description
will have to change to: "Drivers set the array to zero.".

Regards,

Hans
---
diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst 
b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
index b59ce149efb5..45e76e5bc1ea 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst
@@ -144,10 +144,21 @@ id's until they get an error.

 -  .. row 9

-   -  union
+   -  __u32
+
+   -  ``reserved[4]``
+
+   -
+   -
+   -  Reserved for future extensions. Drivers and applications must set
+  the array to zero.

 -  .. row 10

+   -  union
+
+-  .. row 11
+
-
-  struct

@@ -156,7 +167,7 @@ id's until they get an error.
-
-  Valid for (sub-)devices that create a single device node.

--  .. row 11
+-  .. row 12

-
-
@@ -166,7 +177,7 @@ id's until they get an error.

-  Device node major number.

--  .. row 12
+-  .. row 13

-
-
@@ -176,7 +187,7 @@ id's until they get an error.

-  Device node minor number.

--  .. row 13
+-  .. row 14

-
-  __u8
diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst 
b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst
index d05be16ffaf6..256168b3c3be 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst
@@ -125,6 +125,15 @@ returned during the enumeration process.

-  Pad flags, see :ref:`media-pad-flag` for more details.

+-  .. row 4
+
+   -  __u32
+
+   -  ``reserved[2]``
+
+   -  Reserved for future extensions. Drivers and applications must set
+  the array to zero.
+


 .. c:type:: media_link_desc
@@ -161,6 +170,15 @@ returned during the enumeration process.

-  Link flags, see :ref:`media-link-flag` for more details.

+-  .. row 4
+
+   -  __u32
+
+   -  ``reserved[4]``
+
+   -  Reserved for future extensions. Drivers and applications must set
+  the array to zero.
+

 Return Value
 


[RFC PATCH] media: document and zero reservedX fields in media_v2_topology

2018-02-03 Thread Hans Verkuil
The MEDIA_IOC_G_TOPOLOGY documentation didn't document the reservedX fields.
Related to that was that the documented type of the num_* fields was also
wrong.

The reservedX fields were not set to 0, that is now also fixed.

Found with v4l2-compliance.

Signed-off-by: Hans Verkuil 
---
I think that the kernel should set these reserved fields to 0. What is
less clear is if userspace should set them to 0 as well. I think there are
very few users of this ioctl, so I have documented this as "Applications
and drivers shall set this to 0.".

However, it may be to late to make that change to the spec. In that case
it will become "Drivers shall set this to 0.".

Comments?

Hans
---
diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst 
b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
index 997e6b17440d..cd44153199ac 100644
--- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
+++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
@@ -68,7 +68,7 @@ desired arrays with the media graph elements.

 -  .. row 2

-   -  __u64
+   -  __u32

-  ``num_entities``

@@ -76,6 +76,14 @@ desired arrays with the media graph elements.

 -  .. row 3

+   -  __u32
+
+   -  ``reserved1``
+
+   -  Applications and drivers shall set this to 0.
+
+-  .. row 4
+
-  __u64

-  ``ptr_entities``
@@ -85,15 +93,23 @@ desired arrays with the media graph elements.
  the ioctl won't store the entities. It will just update
  ``num_entities``

--  .. row 4
+-  .. row 5

-   -  __u64
+   -  __u32

-  ``num_interfaces``

-  Number of interfaces in the graph

--  .. row 5
+-  .. row 6
+
+   -  __u32
+
+   -  ``reserved2``
+
+   -  Applications and drivers shall set this to 0.
+
+-  .. row 7

-  __u64

@@ -104,15 +120,23 @@ desired arrays with the media graph elements.
  the ioctl won't store the interfaces. It will just update
  ``num_interfaces``

--  .. row 6
+-  .. row 8

-   -  __u64
+   -  __u32

-  ``num_pads``

-  Total number of pads in the graph

--  .. row 7
+-  .. row 9
+
+   -  __u32
+
+   -  ``reserved3``
+
+   -  Applications and drivers shall set this to 0.
+
+-  .. row 10

-  __u64

@@ -122,15 +146,23 @@ desired arrays with the media graph elements.
  converted to a 64-bits integer. It can be zero. if zero, the ioctl
  won't store the pads. It will just update ``num_pads``

--  .. row 8
+-  .. row 11

-   -  __u64
+   -  __u32

-  ``num_links``

-  Total number of data and interface links in the graph

--  .. row 9
+-  .. row 12
+
+   -  __u32
+
+   -  ``reserved4``
+
+   -  Applications and drivers shall set this to 0.
+
+-  .. row 13

-  __u64

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index e79f72b8b858..5b8bf62cd1de 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -263,6 +263,7 @@ static long media_device_get_topology(struct media_device 
*mdev,
uentity++;
}
topo->num_entities = i;
+   topo->reserved1 = 0;

/* Get interfaces and number of interfaces */
i = 0;
@@ -298,6 +299,7 @@ static long media_device_get_topology(struct media_device 
*mdev,
uintf++;
}
topo->num_interfaces = i;
+   topo->reserved2 = 0;

/* Get pads and number of pads */
i = 0;
@@ -324,6 +326,7 @@ static long media_device_get_topology(struct media_device 
*mdev,
upad++;
}
topo->num_pads = i;
+   topo->reserved3 = 0;

/* Get links and number of links */
i = 0;
@@ -355,6 +358,7 @@ static long media_device_get_topology(struct media_device 
*mdev,
ulink++;
}
topo->num_links = i;
+   topo->reserved4 = 0;

return ret;
 }


[PATCH] subdev-formats.rst: fix incorrect types

2018-02-03 Thread Hans Verkuil
The ycbcr_enc, quantization and xfer_func fields are __u16 and not enums.

Signed-off-by: Hans Verkuil 
---
diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst 
b/Documentation/media/uapi/v4l/subdev-formats.rst
index b1eea44550e1..4f0c0b282f98 100644
--- a/Documentation/media/uapi/v4l/subdev-formats.rst
+++ b/Documentation/media/uapi/v4l/subdev-formats.rst
@@ -33,17 +33,17 @@ Media Bus Formats
   - Image colorspace, from enum
:c:type:`v4l2_colorspace`. See
:ref:`colorspaces` for details.
-* - enum :c:type:`v4l2_ycbcr_encoding`
+* - __u16
   - ``ycbcr_enc``
   - This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
-* - enum :c:type:`v4l2_quantization`
+* - __u16
   - ``quantization``
   - This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output
streams, see :ref:`colorspaces`.
-* - enum :c:type:`v4l2_xfer_func`
+* - __u16
   - ``xfer_func``
   - This information supplements the ``colorspace`` and must be set by
the driver for capture streams and by the application for output


Please help test the new v4l-subdev support in v4l2-compliance

2018-02-03 Thread Hans Verkuil
Hi Tim, Jacopo,

I have now finished writing the v4l2-compliance tests for the various v4l-subdev
ioctls. I managed to test some with the vimc driver, but that doesn't implement 
all
ioctls, so I could use some help testing my test code :-)

To test you first need to apply these patches to your kernel:

https://patchwork.linuxtv.org/patch/46817/
https://patchwork.linuxtv.org/patch/46822/

Otherwise the compliance test will fail a lot.

Now run v4l2-compliance -u /dev/v4l-subdevX (or -uX as a shortcut) and see what
happens.

I have tested the following ioctls with vimc, so they are likely to be correct:

#define VIDIOC_SUBDEV_G_FMT _IOWR('V',  4, struct 
v4l2_subdev_format)
#define VIDIOC_SUBDEV_S_FMT _IOWR('V',  5, struct 
v4l2_subdev_format)
#define VIDIOC_SUBDEV_ENUM_MBUS_CODE_IOWR('V',  2, struct 
v4l2_subdev_mbus_code_enum)
#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE   _IOWR('V', 74, struct 
v4l2_subdev_frame_size_enum)

All others are untested:

#define VIDIOC_SUBDEV_G_FRAME_INTERVAL  _IOWR('V', 21, struct 
v4l2_subdev_frame_interval)
#define VIDIOC_SUBDEV_S_FRAME_INTERVAL  _IOWR('V', 22, struct 
v4l2_subdev_frame_interval)
#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL   _IOWR('V', 75, struct 
v4l2_subdev_frame_interval_enum)
#define VIDIOC_SUBDEV_G_CROP_IOWR('V', 59, struct 
v4l2_subdev_crop)
#define VIDIOC_SUBDEV_S_CROP_IOWR('V', 60, struct 
v4l2_subdev_crop)
#define VIDIOC_SUBDEV_G_SELECTION   _IOWR('V', 61, struct 
v4l2_subdev_selection)
#define VIDIOC_SUBDEV_S_SELECTION   _IOWR('V', 62, struct 
v4l2_subdev_selection)
#define VIDIOC_SUBDEV_G_EDID_IOWR('V', 40, struct v4l2_edid)
#define VIDIOC_SUBDEV_S_EDID_IOWR('V', 41, struct v4l2_edid)
#define VIDIOC_SUBDEV_S_DV_TIMINGS  _IOWR('V', 87, struct 
v4l2_dv_timings)
#define VIDIOC_SUBDEV_G_DV_TIMINGS  _IOWR('V', 88, struct 
v4l2_dv_timings)
#define VIDIOC_SUBDEV_ENUM_DV_TIMINGS   _IOWR('V', 98, struct 
v4l2_enum_dv_timings)
#define VIDIOC_SUBDEV_QUERY_DV_TIMINGS  _IOR('V', 99, struct 
v4l2_dv_timings)
#define VIDIOC_SUBDEV_DV_TIMINGS_CAP_IOWR('V', 100, struct 
v4l2_dv_timings_cap)

I did the best I could, but there may very well be bugs in the test code.

I will also test the timings and edid ioctls myself later next week at work.

The v4l2-compliance utility can now also test media devices (-m option), 
although that's
early days yet. Eventually I want to be able to walk the graph and test each 
device in
turn.

I have this idea of making v4l2-compliance, cec-compliance and media-compliance
frontends that can all share the actual test code. And perhaps that can include 
a new
dvb-compliance as well.

However, that's future music, for now I just want to get proper ioctl test 
coverage
so driver authors can at least have some confidence in their code by running 
these
tests.

Regards,

Hans


[linux-next:master 3746/12754] drivers/media/dvb-frontends/stb0899_drv.h:151:36: error: weak declaration of 'stb0899_attach' being applied to a already existing, static definition

2018-02-03 Thread kbuild test robot
Hi Wolfgang,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   ba0749266e17f43d4740781b2120127215440bd1
commit: 6cdeaed3b1420bd2569891be0c4123ff59628e9e [3746/12754] media: 
dvb_usb_pctv452e: module refcount changes were unbalanced
config: x86_64-randconfig-s5-02032012 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
git checkout 6cdeaed3b1420bd2569891be0c4123ff59628e9e
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/media/usb/dvb-usb/pctv452e.c:20:0:
   drivers/media/usb/dvb-usb/pctv452e.c: In function 'pctv452e_frontend_attach':
>> drivers/media/dvb-frontends/stb0899_drv.h:151:36: error: weak declaration of 
>> 'stb0899_attach' being applied to a already existing, static definition
static inline struct dvb_frontend *stb0899_attach(struct stb0899_config 
*config,
   ^~

vim +/stb0899_attach +151 drivers/media/dvb-frontends/stb0899_drv.h

ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
150  
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08 
@151  static inline struct dvb_frontend *stb0899_attach(struct stb0899_config 
*config,
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
152  struct i2c_adapter *i2c)
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
153  {
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
154printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
155return NULL;
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
156  }
ae9902da9 drivers/media/dvb/frontends/stb0899_drv.h Manu Abraham 2007-10-08  
157  

:: The code at line 151 was first introduced by commit
:: ae9902da96b4d2d82707706c7fbc93a8e501dde8 V4L/DVB (9417): DVB_ATTACH for 
STB0899, STB6100, TDA8261

:: TO: Manu Abraham 
:: CC: Mauro Carvalho Chehab 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH] v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl

2018-02-03 Thread Hans Verkuil
The VIDIOC_DBG_G/S_REGISTER ioctls imply that VIDIOC_DBG_G_CHIP_INFO is also
present, since without that you cannot use v4l2-dbg.

Just like the implementation in v4l2-ioctl.c this can be implemented in the
core and no drivers need to be modified.

It also makes it possible for v4l2-compliance to properly test the
VIDIOC_DBG_G/S_REGISTER ioctls.

Signed-off-by: Hans Verkuil 
---
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 43fefa73e0a3..77210a20e90e 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -239,6 +255,19 @@ static long subdev_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
return -EPERM;
return v4l2_subdev_call(sd, core, s_register, p);
}
+   case VIDIOC_DBG_G_CHIP_INFO:
+   {
+   struct v4l2_dbg_chip_info *p = arg;
+
+   if (p->match.type != V4L2_CHIP_MATCH_SUBDEV || p->match.addr)
+   return -EINVAL;
+   if (sd->ops->core && sd->ops->core->s_register)
+   p->flags |= V4L2_CHIP_FL_WRITABLE;
+   if (sd->ops->core && sd->ops->core->g_register)
+   p->flags |= V4L2_CHIP_FL_READABLE;
+   strlcpy(p->name, sd->name, sizeof(p->name));
+   return 0;
+   }
 #endif

case VIDIOC_LOG_STATUS: {


[PATCHv2] v4l2-subdev: clear reserved fields

2018-02-03 Thread Hans Verkuil
Clear the reserved fields for these ioctls according to the specification:

VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION

Found with v4l2-compliance.

Signed-off-by: Hans Verkuil 
---
Change since v1:
- also clear format->format.reserved for the G/S_FMT ioctls.
---
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 43fefa73e0a3..77210a20e90e 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -260,6 +289,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (rval)
return rval;

+   memset(format->reserved, 0, sizeof(format->reserved));
+   memset(format->format.reserved, 0, 
sizeof(format->format.reserved));
return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, 
format);
}

@@ -270,6 +301,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (rval)
return rval;

+   memset(format->reserved, 0, sizeof(format->reserved));
+   memset(format->format.reserved, 0, 
sizeof(format->format.reserved));
return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, 
format);
}

@@ -281,6 +314,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (rval)
return rval;

+   memset(crop->reserved, 0, sizeof(crop->reserved));
memset(, 0, sizeof(sel));
sel.which = crop->which;
sel.pad = crop->pad;
@@ -298,6 +332,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
struct v4l2_subdev_crop *crop = arg;
struct v4l2_subdev_selection sel;

+   memset(crop->reserved, 0, sizeof(crop->reserved));
rval = check_crop(sd, crop);
if (rval)
return rval;
@@ -326,6 +361,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (code->pad >= sd->entity.num_pads)
return -EINVAL;

+   memset(code->reserved, 0, sizeof(code->reserved));
return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,
code);
}
@@ -340,6 +376,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (fse->pad >= sd->entity.num_pads)
return -EINVAL;

+   memset(fse->reserved, 0, sizeof(fse->reserved));
return v4l2_subdev_call(sd, pad, enum_frame_size, 
subdev_fh->pad,
fse);
}
@@ -350,6 +387,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (fi->pad >= sd->entity.num_pads)
return -EINVAL;

+   memset(fi->reserved, 0, sizeof(fi->reserved));
return v4l2_subdev_call(sd, video, g_frame_interval, arg);
}

@@ -359,6 +397,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (fi->pad >= sd->entity.num_pads)
return -EINVAL;

+   memset(fi->reserved, 0, sizeof(fi->reserved));
return v4l2_subdev_call(sd, video, s_frame_interval, arg);
}

@@ -372,6 +411,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (fie->pad >= sd->entity.num_pads)
return -EINVAL;

+   memset(fie->reserved, 0, sizeof(fie->reserved));
return v4l2_subdev_call(sd, pad, enum_frame_interval, 
subdev_fh->pad,
fie);
}
@@ -383,6 +423,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (rval)
return rval;

+   memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call(
sd, pad, get_selection, subdev_fh->pad, sel);
}
@@ -394,6 +435,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
if (rval)
return rval;

+   memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call(
sd, pad, set_selection, subdev_fh->pad, sel);
}


[PATCHv2] v4l2-ctrls.h: fix wrong copy-and-paste comment

2018-02-03 Thread Hans Verkuil
The __v4l2_ctrl_modify_range is the unlocked variant, so the comment about
taking a lock is obviously wrong.

Signed-off-by: Hans Verkuil 
Acked-by: Sakari Ailus 
---
Change since v1: replace the comment with something better instead of deleting 
it.
---
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 5253b5471897..1e599f10c893 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -761,8 +761,8 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
  * An error is returned if one of the range arguments is invalid for this
  * control type.
  *
- * This function assumes that the control handler is not locked and will
- * take the lock itself.
+ * The caller is responsible for acquiring the control handler mutex on behalf
+ * of __v4l2_ctrl_modify_range().
  */
 int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
 s64 min, s64 max, u64 step, s64 def);


Re: [PATCH] media: cx25821: prevent out-of-bounds read on array card

2018-02-03 Thread kbuild test robot
Hi Colin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.15 next-20180202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Colin-King/media-cx25821-prevent-out-of-bounds-read-on-array-card/20180203-130958
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-sb0-02031534 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:15:0,
from include/linux/list.h:9,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/i2c.h:30,
from drivers/media/pci/cx25821/cx25821-core.c:22:
   drivers/media/pci/cx25821/cx25821-core.c: In function 'cx25821_dev_setup':
>> include/linux/build_bug.h:30:45: warning: format '%ld' expects argument of 
>> type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
   include/linux/compiler-gcc.h:65:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
   ^
   include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
  ^
>> include/linux/printk.h:308:34: note: in expansion of macro 'ARRAY_SIZE'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^
   drivers/media/pci/cx25821/cx25821.h:380:2: note: in expansion of macro 
'pr_info'
 pr_info("(%d): " fmt, dev->board, ##args)
 ^
   drivers/media/pci/cx25821/cx25821-core.c:871:3: note: in expansion of macro 
'CX25821_INFO'
  CX25821_INFO("dev->nr >= %ld", ARRAY_SIZE(card));
  ^
--
   In file included from include/linux/kernel.h:15:0,
from include/linux/list.h:9,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/i2c.h:30,
from drivers/media//pci/cx25821/cx25821-core.c:22:
   drivers/media//pci/cx25821/cx25821-core.c: In function 'cx25821_dev_setup':
>> include/linux/build_bug.h:30:45: warning: format '%ld' expects argument of 
>> type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
   include/linux/compiler-gcc.h:65:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
   ^
   include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
  ^
>> include/linux/printk.h:308:34: note: in expansion of macro 'ARRAY_SIZE'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^
   drivers/media//pci/cx25821/cx25821.h:380:2: note: in expansion of macro 
'pr_info'
 pr_info("(%d): " fmt, dev->board, ##args)
 ^
   drivers/media//pci/cx25821/cx25821-core.c:871:3: note: in expansion of macro 
'CX25821_INFO'
  CX25821_INFO("dev->nr >= %ld", ARRAY_SIZE(card));
  ^

vim +/ARRAY_SIZE +308 include/linux/printk.h

968ab183 Linus Torvalds 2010-11-15  287  
6e099f55 Dan Streetman  2014-06-04  288  /*
6e099f55 Dan Streetman  2014-06-04  289   * These can be used to print at the 
various log levels.
6e099f55 Dan Streetman  2014-06-04  290   * All of these will print 
unconditionally, although note that pr_debug()
6e099f55 Dan Streetman  2014-06-04  291   * and other debug macros are compiled 
out unless either DEBUG is defined
6e099f55 Dan Streetman  2014-06-04  292   * or CONFIG_DYNAMIC_DEBUG is set.
6e099f55 Dan Streetman  2014-06-04  293   */
a0cba217 Linus Torvalds 2016-08-09  294  #define pr_emerg(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  295 printk(KERN_EMERG pr_fmt(fmt), 
##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  296  #define pr_alert(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  297 printk(KERN_ALERT pr_fmt(fmt), 
##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  298  #define pr_crit(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  299 printk(KERN_CRIT pr_fmt(fmt), 
##__VA_ARGS__)