From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [patch] fbdev: off by one test (harmless)
Date: Tue, 13 Jan 2015 11:19:17 +0000 [thread overview]
Message-ID: <54B4FF35.8050703@ti.com> (raw)
In-Reply-To: <20141226172657.GA14762@mwanda>
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
On 29/12/14 23:51, David Ung wrote:
>
>>> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-01-13 11:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 17:26 [patch] fbdev: off by one test (harmless) Dan Carpenter
2014-12-27 1:29 ` Jingoo Han
2014-12-29 21:51 ` David Ung
2015-01-13 11:19 ` Tomi Valkeinen [this message]
2015-01-14 5:24 ` David Ung
2015-01-15 11:42 ` Tomi Valkeinen
2015-01-15 11:56 ` Tomi Valkeinen
2015-01-15 12:26 ` Dan Carpenter
2015-01-15 12:39 ` Tomi Valkeinen
2015-01-15 12:43 ` Dan Carpenter
2015-01-15 12:52 ` Tomi Valkeinen
2015-07-23 12:39 ` Dan Carpenter
2015-08-10 9:38 ` Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54B4FF35.8050703@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).