From: Trent Piepho <xyzzy@speakeasy.org>
To: Adrian Bunk <bunk@stusta.de>
Cc: Thierry MERLE <thierry.merle@free.fr>,
"Dwaine P. Garden" <dwainegarden@rogers.com>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>,
Linux Kernel Mailing list <linux-kernel@vger.kernel.org>,
Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Subject: Re: [v4l-dvb-maintainer] [2.6.23 regression fix] usbvision: don't return an uninitialized value
Date: Mon, 23 Jul 2007 03:02:29 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0707230254390.5535@shell2.speakeasy.net> (raw)
In-Reply-To: <20070723080203.GD26212@stusta.de>
On Mon, 23 Jul 2007, Adrian Bunk wrote:
> Commit c5f48367fe54c46805774eeea8e828de54a5ad7b introduced this return
> of an uninitialized variable.
>
> Spotted by the Coverity checker.
It spotted that, but it seems it missed the bigger bug, reg->val is
unsigned. Since reg->val can't be less than 0, it will never actually
return the unitialized variable.
This patch should fix it correctly. The vidioc_g_register function was
broken too, it wasn't actually setting reg->val to the register value it
read.
--------------------------------------------------------------------
usbvision: fix bugs in vidioc_[sg]_register functions
From: Trent Piepho <xyzzy@speakeasy.org>
s_register was assigning the return code to (unsigned)reg->val, rather than
errCode, which it what it would return. Except reg->val can't be < 0, so it
would never actually return an error.
g_register never actually put the value it read into reg->val.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
diff -r 8e72fe5675b3 -r d5c4fffbbad3 linux/drivers/media/video/usbvision/usbvision-video.c
--- a/linux/drivers/media/video/usbvision/usbvision-video.c Sat Jul 21 17:26:40 2007 -0700
+++ b/linux/drivers/media/video/usbvision/usbvision-video.c Mon Jul 23 02:58:31 2007 -0700
@@ -550,6 +550,7 @@ static int vidioc_g_register (struct fil
__FUNCTION__, errCode);
return errCode;
}
+ reg->val = errCode;
return 0;
}
@@ -564,8 +565,8 @@ static int vidioc_s_register (struct fil
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
return -EINVAL;
/* NT100x has a 8-bit register space */
- reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
- if (reg->val < 0) {
+ errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
+ if (errCode < 0) {
err("%s: VIDIOC_DBG_S_REGISTER failed: error %d",
__FUNCTION__, errCode);
return errCode;
prev parent reply other threads:[~2007-07-23 10:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 8:02 Adrian Bunk
2007-07-23 10:02 ` Trent Piepho [this message]
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=Pine.LNX.4.58.0707230254390.5535@shell2.speakeasy.net \
--to=xyzzy@speakeasy.org \
--cc=bunk@stusta.de \
--cc=dwainegarden@rogers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=thierry.merle@free.fr \
--cc=v4l-dvb-maintainer@linuxtv.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
all inboxes | Powered by JetHome®