From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Mathieu Othacehe <m.othacehe@gmail.com>
Subject: [PATCH 09/11] iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Date: Sat, 1 May 2021 18:13:50 +0100 [thread overview]
Message-ID: <20210501171352.512953-10-jic23@kernel.org> (raw)
In-Reply-To: <20210501171352.512953-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.
Here an explicit structure is not used, because the holes would
necessitate the addition of an explict memset(), to avoid a kernel
data leak, making for a less minimal fix.
Found during an audit of all callers of iio_push_to_buffers_with_timestamp()
Fixes: 8fe78d5261e7 ("iio: vcnl4000: Add buffer support for VCNL4010/20.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mathieu Othacehe <m.othacehe@gmail.com>
---
drivers/iio/light/vcnl4000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 2f7916f95689..3b5e27053ef2 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -910,7 +910,7 @@ static irqreturn_t vcnl4010_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct vcnl4000_data *data = iio_priv(indio_dev);
const unsigned long *active_scan_mask = indio_dev->active_scan_mask;
- u16 buffer[8] = {0}; /* 1x16-bit + ts */
+ u16 buffer[8] __aligned(8) = {0}; /* 1x16-bit + naturally aligned ts */
bool data_read = false;
unsigned long isr;
int val = 0;
--
2.31.1
next prev parent reply other threads:[~2021-05-01 17:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 17:13 [PATCH 00/11] IIO: Alignment fixes part 3 - __aligned(8) used to ensure alignment Jonathan Cameron
2021-05-01 17:13 ` [PATCH 01/11] iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Jonathan Cameron
2021-05-26 17:23 ` Eugen.Hristev
2021-05-27 8:48 ` Jonathan Cameron
2021-05-01 17:13 ` [PATCH 02/11] iio: adc: hx711: " Jonathan Cameron
2021-05-01 17:13 ` [PATCH 03/11] iio: adc: mxs-lradc: " Jonathan Cameron
2021-05-01 17:13 ` [PATCH 04/11] iio: adc: ti-ads8688: Fix alignment of buffer " Jonathan Cameron
2021-05-01 17:13 ` [PATCH 05/11] iio: chemical: atlas: Fix buffer alignment " Jonathan Cameron
2021-05-06 6:44 ` Matt Ranostay
2021-05-13 17:59 ` Jonathan Cameron
2021-05-01 17:13 ` [PATCH 06/11] iio: cros_ec_sensors: Fix alignment of buffer " Jonathan Cameron
2021-05-01 23:58 ` Gwendal Grignou
2021-05-13 18:03 ` Jonathan Cameron
2021-05-01 17:13 ` [PATCH 07/11] iio: potentiostat: lmp91000: " Jonathan Cameron
2021-05-06 6:44 ` Matt Ranostay
2021-05-13 18:04 ` Jonathan Cameron
2021-05-01 17:13 ` [PATCH 08/11] iio: magn: rm3100: " Jonathan Cameron
2021-05-01 17:13 ` Jonathan Cameron [this message]
2021-05-01 17:13 ` [PATCH 10/11] iio: light: vcnl4035: Fix buffer alignment " Jonathan Cameron
2021-05-01 17:13 ` [PATCH 11/11] iio: prox: isl29501: " Jonathan Cameron
2021-05-13 17:58 ` [PATCH 00/11] IIO: Alignment fixes part 3 - __aligned(8) used to ensure alignment Jonathan Cameron
2021-05-26 17:09 ` Jonathan Cameron
2021-05-26 17:17 ` Andy Shevchenko
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=20210501171352.512953-10-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-iio@vger.kernel.org \
--cc=m.othacehe@gmail.com \
/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).