From: Antti Palosaari <crope@iki.fi>
To: Dan Carpenter <error27@gmail.com>
Cc: Steve Kerrison <steve@stevekerrison.com>,
Mauro Carvalho Chehab <mchehab@redhat.com>,
linux-media@vger.kernel.org
Subject: Re: [bug report] cxd2820r: dynamically allocated arrays
Date: Wed, 25 May 2011 17:48:04 +0300 [thread overview]
Message-ID: <4DDD16A4.8000300@iki.fi> (raw)
In-Reply-To: <20110525144246.GD1358@shale.localdomain>
Hello Dan,
I am just fixing those and also some other fixes.
regards,
Antti
On 05/25/2011 05:42 PM, Dan Carpenter wrote:
> This driver has several places that use dynamically sized arrays.
> It's dangerous to do that in the kernel because the kernel has a
> very small stack. A bug could cause the stack to overflow and
> corrupt memory. I seem to recall i2c transfers can be triggered by
> the users but I don't know the details (ie security implications).
>
> Here is an example of what I mean:
>
> static int cxd2820r_tuner_i2c_xfer(struct i2c_adapter *i2c_adap,
> struct i2c_msg msg[], int num)
> {
> struct cxd2820r_priv *priv = i2c_get_adapdata(i2c_adap);
> u8 obuf[msg[0].len + 2];
> ^^^^^^^^^^
> struct i2c_msg msg2[2] = {
>
> If msg[0].len is too long it will overflow.
>
> Here is the sparse output for the file:
>
> CHECK drivers/media/dvb/frontends/cxd2820r_core.c
> drivers/media/dvb/frontends/cxd2820r.h:58:30: error: dubious one-bit signed bitfield
> drivers/media/dvb/frontends/cxd2820r.h:64:23: error: dubious one-bit signed bitfield
> drivers/media/dvb/frontends/cxd2820r_priv.h:58:26: error: dubious one-bit signed bitfield
> drivers/media/dvb/frontends/cxd2820r_priv.h:64:31: error: dubious one-bit signed bitfield
> drivers/media/dvb/frontends/cxd2820r_core.c:33:19: error: bad constant expression
> drivers/media/dvb/frontends/cxd2820r_core.c:38:32: error: cannot size expression
> drivers/media/dvb/frontends/cxd2820r_core.c:61:16: error: bad constant expression
> drivers/media/dvb/frontends/cxd2820r_core.c:71:32: error: cannot size expression
> drivers/media/dvb/frontends/cxd2820r_core.c:743:28: error: bad constant expression
> drivers/media/dvb/frontends/cxd2820r_core.c:748:32: error: cannot size expression
> drivers/media/dvb/frontends/cxd2820r_core.c:762:31: error: cannot size expression
> CC [M] drivers/media/dvb/frontends/cxd2820r_core.o
>
> regards,
> dan carpenter
--
http://palosaari.fi/
prev parent reply other threads:[~2011-05-25 14:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 14:42 [bug report] cxd2820r: dynamically allocated arrays Dan Carpenter
2011-05-25 14:48 ` Antti Palosaari [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=4DDD16A4.8000300@iki.fi \
--to=crope@iki.fi \
--cc=error27@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=steve@stevekerrison.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