Thread (13 messages) flat view 13 messages, 4 authors, 2015-08-10

Re: [patch] fbdev: off by one test (harmless)

From: Tomi Valkeinen <hidden>
Date: 2015-01-13 11:19:17
Also in: kernel-janitors

On 29/12/14 23:51, David Ung wrote:
quoted
quoted
test is really a no-op.  But it's still off by one and upsets the
static checkers so we may as well correct it.
'idx' should be 0~63, because cea_modes array is defined as
'cea_modes[64]'.
According to CEA/EIA-861E, there are 64 defined modes, but idx is valid for 1-64, 0 is reserved hence the check for 

        If (!idx || idx > 63) {

Think idx check really should be !idx || idx > 64 if following CEA/EIA-861E
In that case there's something funny with the code. The code indexes
'cea_modes' using 'idx', and I _think_ cea_modes is already offset
properly, i.e. there's no entry at 0. But its length is 64, which is not
right, as there's the empty item in the beginning.

So maybe the correct fix is to increase the length of cea_modes to 65,
and change the idx check as you mention above?

 Tomi

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help