From: Vitaly Wool <vital@embeddedalley.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: video4linux-list@redhat.com
Subject: [patch] tvaudio: remove bogus check
Date: Mon, 02 Mar 2009 18:12:06 +0300 [thread overview]
Message-ID: <49ABF746.8000506@embeddedalley.com> (raw)
Hello Mauro,
below is the patch that removes the subaddr check against ARRAY_SIZE(chip->shadow.bytes).
Regardless of anything, the 'bytes' array is 64 bytes large so this check disables
easy standard programming (TDA9874A_ESP) which has a number of 255 which is hardly the
intended behavior.
As a matter of fact, we can think of separate check for this case like
if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes) ||
subaddr != 0xFF) {
... /* weird register, refuse */
}
but I'm not sure if there are no other special cases so for now I suggest to just disable
it.
drivers/media/video/tvaudio.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
Signed-off-by: Vitaly Wool <vital@embeddedalley.com>
Index: linux-next/drivers/media/video/tvaudio.c
===================================================================
--- linux-next.orig/drivers/media/video/tvaudio.c 2009-03-02 17:50:40.000000000 +0300
+++ linux-next/drivers/media/video/tvaudio.c 2009-03-02 18:08:08.000000000 +0300
@@ -169,13 +169,6 @@
return -1;
}
} else {
- if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
- v4l2_info(sd,
- "Tried to access a non-existent register: %d\n",
- subaddr);
- return -EINVAL;
- }
-
v4l2_dbg(1, debug, sd, "chip_write: reg%d=0x%x\n",
subaddr, val);
chip->shadow.bytes[subaddr+1] = val;
@@ -198,16 +191,8 @@
if (mask != 0) {
if (subaddr < 0) {
val = (chip->shadow.bytes[1] & ~mask) | (val & mask);
- } else {
- if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
- v4l2_info(sd,
- "Tried to access a non-existent register: %d\n",
- subaddr);
- return -EINVAL;
- }
-
+ } else
val = (chip->shadow.bytes[subaddr+1] & ~mask) | (val & mask);
- }
}
return chip_write(chip, subaddr, val);
}
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
next reply other threads:[~2009-03-02 15:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-02 15:12 Vitaly Wool [this message]
2009-03-02 16:02 ` [patch] tvaudio: remove bogus check Alexey Klimov
2009-03-02 19:47 ` Mauro Carvalho Chehab
2009-03-03 13:25 ` Vitaly Wool
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=49ABF746.8000506@embeddedalley.com \
--to=vital@embeddedalley.com \
--cc=mchehab@infradead.org \
--cc=video4linux-list@redhat.com \
/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