All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	devel@driverdev.osuosl.org, Jonathan Cameron <jic23@cam.ac.uk>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 01/18] iio: Add helper functions for enum style channel attributes
Date: Tue, 5 Jun 2012 13:45:27 +0900	[thread overview]
Message-ID: <20120605044527.GA10353@kroah.com> (raw)
In-Reply-To: <20120604105510.GB4400@mwanda>

On Mon, Jun 04, 2012 at 01:55:10PM +0300, Dan Carpenter wrote:
> On Mon, Jun 04, 2012 at 11:36:11AM +0200, Lars-Peter Clausen wrote:
> > +ssize_t iio_enum_available_read(struct iio_dev *indio_dev,
> > +	uintptr_t priv, const struct iio_chan_spec *chan, char *buf)
> > +{
> > +	const struct iio_enum *e = (const struct iio_enum *)priv;
> > +	unsigned int i;
> > +	size_t len = 0;
> > +
> > +	if (!e->num_items)
> > +		return 0;
> > +
> > +	for (i = 0; i < e->num_items; ++i)
> > +		len += snprintf(buf + len, PAGE_SIZE - len, "%s ", e->items[i]);
> > +
> > +	/* replace last space with a newline */
> > +	buf[len - 1] = '\n';
> > +
> 
> It would be better to use scnprintf() here instead of snprintf().
> snprintf() returns the number of characters that would have been
> printed if there were space (not counting the NULL), so len - 1 can
> be beyond the end of the array.

Good idea.  Lars, care to send a follow-on patch that fixes this up?

thanks,

greg k-h

  parent reply	other threads:[~2012-06-05  4:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04  9:36 [PATCH 01/18] iio: Add helper functions for enum style channel attributes Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 02/18] staging:iio:dac:ad5064: Use iio_enum for powerdown modes Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 03/18] staging:iio:dac:ad5446: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 04/18] staging:iio:dac:ad5380: Convert to extended channel attributes Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 05/18] staging:iio:dac:ad5504: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 06/18] staging:iio:dac:ad5624r: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 07/18] staging:iio:dac:ad5686: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 08/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 09/18] staging:iio:dac: Remove unused dac.h includes Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 10/18] staging:iio:dac:max517: Convert to channel spec Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 11/18] staging:iio:dac: Remove dac.h Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 12/18] staging:iio:dac:ad5504: Use strtobool for boolean values Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 13/18] staging:iio:dac:ad5624r: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 14/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 15/18] staging:iio:dac:ad5504: Check if IRQ was requested before freeing it Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 16/18] staging:iio:dac:ad5504: Move private structs and defines from header to C file Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 17/18] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-06-04  9:36 ` [PATCH 18/18] staging:iio: Move DAC drivers out of staging Lars-Peter Clausen
2012-06-04 10:55 ` [PATCH 01/18] iio: Add helper functions for enum style channel attributes Dan Carpenter
2012-06-04 20:12   ` Lars-Peter Clausen
2012-06-04 20:36     ` Dan Carpenter
2012-06-05  4:45   ` Greg Kroah-Hartman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-21 11:42 Lars-Peter Clausen
2012-05-21 16:40 ` Jonathan Cameron

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=20120605044527.GA10353@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@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 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.