• Mauro Carvalho Chehab's avatar
    media: vivid: shut up warnings due to a non-trivial logic · 3354b54f
    Mauro Carvalho Chehab authored
    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: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    3354b54f
vivid-core.c 50.9 KB