All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Daniel Baluta <daniel.baluta@oss.nxp.com>
Subject: [PATCH v4 4/8] iio:imu:bmi160: Fix too large a buffer.
Date: Sun, 20 Sep 2020 12:27:38 +0100	[thread overview]
Message-ID: <20200920112742.170751-5-jic23@kernel.org> (raw)
In-Reply-To: <20200920112742.170751-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The comment implies this device has 3 sensor types, but it only
has an accelerometer and a gyroscope (both 3D).  As such the
buffer does not need to be as long as stated.

Note I've separated this from the following patch which fixes
the alignment for passing to iio_push_to_buffers_with_timestamp()
as they are different issues even if they affect the same line
of code.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Daniel Baluta <daniel.baluta@oss.nxp.com>
---
 v4: New patch
 drivers/iio/imu/bmi160/bmi160_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 222ebb26f013..39fea58dd308 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -427,8 +427,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
 	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
 	struct bmi160_data *data = iio_priv(indio_dev);
-	__le16 buf[16];
-	/* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */
+	__le16 buf[12];
+	/* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */
 	int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
 	__le16 sample;
 
-- 
2.28.0


  parent reply	other threads:[~2020-09-20 11:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 11:27 [PATCH v4 0/8] IIO: Fused set 1 and 2 of timestamp alignment fixes Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 1/8] iio:light:rpr0521: Fix timestamp alignment and prevent data leak Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 2/8] iio:light:st_uvis25: " Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 3/8] iio:magnetometer:mag3110: Fix alignment and data leak issues Jonathan Cameron
2020-09-20 11:27 ` Jonathan Cameron [this message]
2020-09-20 11:27 ` [PATCH v4 5/8] iio:imu:bmi160: " Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 6/8] iio:pressure:mpl3115: Force alignment of buffer Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 7/8] iio:adc:ti-ads124s08: Fix buffer being too long Jonathan Cameron
2020-09-20 11:27 ` [PATCH v4 8/8] iio:adc:ti-ads124s08: Fix alignment and data leak issues Jonathan Cameron
2020-11-29 13:22 ` [PATCH v4 0/8] IIO: Fused set 1 and 2 of timestamp alignment fixes Jonathan Cameron
2020-11-29 16:15   ` Alexandru Ardelean
2020-11-29 18:33     ` Jonathan Cameron
2020-11-29 20:26       ` Alexandru Ardelean
2020-11-30 13:13         ` 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=20200920112742.170751-5-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=daniel.baluta@oss.nxp.com \
    --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.