From: Jonathan Cameron <jic23@kernel.org>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Revert e0922e5e3ccb78aa0152e93dfbd1755ac39c8582
Date: Sat, 14 Feb 2015 11:34:42 +0000 [thread overview]
Message-ID: <54DF32D2.70105@kernel.org> (raw)
In-Reply-To: <CAHQ1cqG313SrRWbBLaHm1gwmdTOXOqjviBaA8tEcsbv7m=n-Bg@mail.gmail.com>
On 12/02/15 20:23, Andrey Smirnov wrote:
> Hi Jonathan,
>
> Please revert patch e0922e5e3ccb78aa0152e93dfbd1755ac39c8582:
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/iio/humidity/si7020.c?id=e0922e5e3ccb78aa0152e93dfbd1755ac39c8582
>
> It incorrectly assumes that the level of indirection is not needed
> which is not true(probably because the driver incorrectly allocates
> sizeof(*client) instead of sizeof(*data) via devm_iio_device_alloc).
> If you look at the code of the probe function(see below) it is easy to
> see that what is being stored in the private memory of the IIO device
> instance is not a copy of a 'struct i2c_client' but a pointer to an
> instance passed as an argument to the probe function.
>
> struct i2c_client **data;
> int ret;
>
> < Some code skipped >
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
> if (!indio_dev)
> return -ENOMEM;
>
> data = iio_priv(indio_dev);
> *data = client;
>
> Without reverting this change any read of a raw value of this sensor
> leads to a kernel oops due to a NULL pointer de-reference on my
> hardware setup.
>
> I will be sending a patch to fix the 'sizeof' mixup shortly.
>
> Thank you,
> Andrey Smirnov
>
Reverted in the fixes-togreg branch and cc'd to stable.
I'll pick up the fix as well in a minute.
prev parent reply other threads:[~2015-02-14 11:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 20:23 Revert e0922e5e3ccb78aa0152e93dfbd1755ac39c8582 Andrey Smirnov
2015-02-14 11:34 ` 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=54DF32D2.70105@kernel.org \
--to=jic23@kernel.org \
--cc=andrew.smirnov@gmail.com \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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).