All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Manfred Schlaegl <manfred.schlaegl@gmx.at>,
	Michael Welling <mwelling@ieee.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
Subject: Re: [PATCH] iio: mcp320x: Fix NULL pointer dereference
Date: Sun, 19 Jul 2015 14:00:24 +0100	[thread overview]
Message-ID: <55AB9F68.7000201@kernel.org> (raw)
In-Reply-To: <55A4F848.8060507@gmx.at>

On 14/07/15 12:53, Manfred Schlaegl wrote:
> On 2015-07-13 16:16, Michael Welling wrote:
>> On Fri, Jul 10, 2015 at 10:55:30PM +0200, Manfred Schlaegl wrote:
>>> On reading in_voltage_scale of we got an NULL pointer dereference Oops.
>>>
>>> The reason for this is, that mcp320x_read_raw tries to access
>>> chip_info->resolution from struct mcp320x, but chip_info is never set.
>>>
>>> chip_info was never set since the driver was added, but there was no
>>> acute problem, because it was not referenced.
>>> The acute problem exists since
>>> b12206e917ac34bec41b9ff93d37d8bd53a2b3bc
>>> iio: adc: mcp320x. Add support for more ADCs
>>>
>>> This patch fixes the issue by setting chip_info in mcp320x_probe.
>>>
>>> Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
>>> ---
>>>  drivers/iio/adc/mcp320x.c |    2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
>>> index 8d9c9b9..d819823 100644
>>> --- a/drivers/iio/adc/mcp320x.c
>>> +++ b/drivers/iio/adc/mcp320x.c
>>> @@ -299,6 +299,8 @@ static int mcp320x_probe(struct spi_device *spi)
>>>  	indio_dev->channels = chip_info->channels;
>>>  	indio_dev->num_channels = chip_info->num_channels;
>>>  
>>> +	adc->chip_info = chip_info;
>>> +
>>
>> Looks good to me.
>>
>> Reviewed-by: Michael Welling <mwelling@ieee.org>
>>
>>>  	adc->transfer[0].tx_buf = &adc->tx_buf;
>>>  	adc->transfer[0].len = sizeof(adc->tx_buf);
>>>  	adc->transfer[1].rx_buf = adc->rx_buf;
>>> -- 
>>> 1.7.10.4
>>>
> 
> Thanks for reviewing!
> 
> best regards,
> manfred
> 
Applied to the fixes-togreg branch of iio.git

Michael, there are moves afoot to clarify the meaning of reviewed-by
as covering only more substantial reviews (kind of tricky on a one liner
like this!)  Hence for similar patches in future, an Acked-by may
be more appropriate.

Thanks,

Jonathan

  reply	other threads:[~2015-07-19 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 20:55 [PATCH] iio: mcp320x: Fix NULL pointer dereference Manfred Schlaegl
2015-07-13 14:16 ` Michael Welling
2015-07-14 11:53   ` Manfred Schlaegl
2015-07-19 13:00     ` Jonathan Cameron [this message]
2015-07-19 23:56       ` Michael Welling

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=55AB9F68.7000201@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred.schlaegl@ginzinger.com \
    --cc=manfred.schlaegl@gmx.at \
    --cc=mwelling@ieee.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.