]> asedeno.scripts.mit.edu Git - linux.git/commit
media: vivid: shut up warnings due to a non-trivial logic
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 7 Aug 2018 11:29:12 +0000 (07:29 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 8 Aug 2018 14:57:14 +0000 (10:57 -0400)
commit3354b54f9f7037a1122d3b6009aa9d39829d6843
treee10ad409f67d05d07100718a2f6856d6d8ed888e
parent845b978a871bff3707eee611b32e4be0b9a94dd2
media: vivid: shut up warnings due to a non-trivial logic

The vivid driver uses a complex logic to save one kalloc/kfree
allocation. That non-trivial way of allocating data causes
smatch to warn:
drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'

I also needed to read the code several times in order to understand
what it was desired there. It turns that the logic was right,
although confusing to read.

As it is doing allocations on a non-standard way, let's add some
documentation while shutting up the false positive.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vivid/vivid-core.c