linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Octavian Purdila <octavian.purdila@intel.com>,
	Aybuke Ozdemir <aybuke.147@gmail.com>,
	Josselin Costanzi <josselin.costanzi@mobile-devices.fr>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb()
Date: Sat, 3 Oct 2015 10:28:43 +0100	[thread overview]
Message-ID: <560F9FCB.40704@kernel.org> (raw)
In-Reply-To: <55CF9BA1.7020804@kernel.org>

On 15/08/15 21:05, Jonathan Cameron wrote:
> On 08/08/15 20:16, Dan Carpenter wrote:
>> "num_read" is in byte units but we are write u16s so we end up write
>> twice as much as intended.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Hi Dan,
> 
> This is fine. Given it's an old bug, Greg is not going to take this
> sort of fix until after the merge window.   I won't be doing another
> pull to him to go in during the merge window.  Hence fastest route
> will be as a fix post 4.3-rc1.
> 
> Give me a poke if I haven't picked it up and sent it on by rc2 or so.
> 
> Thanks and good find.
> 
> Jonathan
Nearly forgot this one!

Anyhow, applied to the fixes-togreg branch of iio.git and marked for stable.

Jonathan
>>
>> diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c
>> index 23685e7..bd2c69f 100644
>> --- a/drivers/staging/iio/accel/sca3000_ring.c
>> +++ b/drivers/staging/iio/accel/sca3000_ring.c
>> @@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r,
>>  	if (ret)
>>  		goto error_ret;
>>  
>> -	for (i = 0; i < num_read; i++)
>> +	for (i = 0; i < num_read / sizeof(u16); i++)
>>  		*(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);
>>  
>>  	if (copy_to_user(buf, rx, num_read))
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


      reply	other threads:[~2015-10-03  9:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08 19:16 [patch] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb() Dan Carpenter
2015-08-15 20:05 ` Jonathan Cameron
2015-10-03  9:28   ` Jonathan Cameron [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=560F9FCB.40704@kernel.org \
    --to=jic23@kernel.org \
    --cc=aybuke.147@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=josselin.costanzi@mobile-devices.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=octavian.purdila@intel.com \
    --cc=pmeerw@pmeerw.net \
    /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).