• Mauro Carvalho Chehab's avatar
    media: flexcop-i2c: get rid of KERN_CONT · 25d4affb
    Mauro Carvalho Chehab authored
    Coverity complains about werid stuff at the debug logic:
    
    	CID 113542 (#1 of 1): Out-of-bounds access (ARRAY_VS_SINGLETON)10.
    	callee_ptr_arith: Passing buf to function flexcop_i2c_write4
    	which uses it as an array. This might corrupt or misinterpret
    	adjacent memory locations.
    
    Instead of directly addressing the issue there, let's rework at
    the logic there.
    
    On newer kernels, KERN_CONT does nothing, as the previous message
    won't wait for a continuation. Also, both flexcop_i2c_read4() and
    flexcop_i2c_write4(), called by it, will print stuff if (debug &4).
    
    So, the way it is is too buggy.
    
    There are two kinds of debug stuff there: deb_i2c() and a code hidden
    under #ifdef DUMP_I2C_MESSAGES, with can't be selected without touching
    the source code.
    
    Also, if both debug & 0x4 and DUMP_I2C_MESSAGES, flexcop_i2c_request()
    will emit two debug messages per call with different data,
    with sounds messy.
    
    Simplify it by getting rid of DUMP_I2C_MESSAGES and adding a new
    flag to debug (0x40), and making the debug logic there more
    consistent.
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    25d4affb
flexcop-i2c.c 7.71 KB