All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: Fix unitialized use of list
Date: Tue, 03 Jul 2012 21:05:18 +0100	[thread overview]
Message-ID: <4FF3507E.3080002@kernel.org> (raw)
In-Reply-To: <1341305740-17939-1-git-send-email-s.hauer@pengutronix.de>

On 07/03/2012 09:55 AM, Sascha Hauer wrote:
> The dev_attr list is initialized in __iio_add_event_config_attrs which
> is called only when indio_dev->channels is true. Nevertheless the list
> is used unconditionally later in iio_device_register_eventset which
> results in a NULL pointer exception. To fix this unconditionally
> initialize the list in iio_device_register_eventset.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
merged to fixes. Thanks.
> ---
>  drivers/iio/industrialio-event.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
> index b49059d..fa6543b 100644
> --- a/drivers/iio/industrialio-event.c
> +++ b/drivers/iio/industrialio-event.c
> @@ -345,7 +345,6 @@ static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev)
>  {
>  	int j, ret, attrcount = 0;
>  
> -	INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
>  	/* Dynically created from the channels array */
>  	for (j = 0; j < indio_dev->num_channels; j++) {
>  		ret = iio_device_add_event_sysfs(indio_dev,
> @@ -396,6 +395,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
>  		goto error_ret;
>  	}
>  
> +	INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
> +
>  	iio_setup_ev_int(indio_dev->event_interface);
>  	if (indio_dev->info->event_attrs != NULL) {
>  		attr = indio_dev->info->event_attrs->attrs;
> 



      reply	other threads:[~2012-07-03 20:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03  8:55 [PATCH] iio: Fix unitialized use of list Sascha Hauer
2012-07-03 20:05 ` 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=4FF3507E.3080002@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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.