From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Shengzhuo Wei <me@cherr.cc>
Cc: "Ramona Gradinariu" <ramona.gradinariu@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
linux@analog.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: accel: adxl367: reject out-of-range FIFO entry count
Date: Wed, 12 Aug 2026 11:08:43 +0300 [thread overview]
Message-ID: <anwqC4tczcdnmF1u@ashevche-desk.local> (raw)
In-Reply-To: <20260812-adxl-fifo-v2-2-86bea20faf1c@cherr.cc>
On Wed, Aug 12, 2026 at 03:58:50PM +0800, Shengzhuo Wei wrote:
> The FIFO entry count reported by the device can be as large as 1023
> (the low byte plus the low two bits of the high byte), but fifo_buf[]
> only has room for ADXL367_FIFO_SIZE (512) entries.
> adxl367_push_fifo_data() passes the reported count straight to the FIFO
> read, so a count above ADXL367_FIFO_SIZE overflows fifo_buf, a heap
> out-of-bounds write of up to 1022 bytes into adjacent memory.
>
> Rather than clamp the count and silently drop the excess, abort the
> read: a count beyond the FIFO size means the device is returning
> garbage, so the data cannot be trusted. The message is ratelimited
> because a stuck device can raise the IRQ repeatedly.
Aren't they already were discussed in linux-iio@ mailing list earlier?
...
> + dev_err_ratelimited(st->dev,
> + "FIFO entry count %u exceeds FIFO size %lu\n",
> + fifo_entries,
> + (unsigned long)ADXL367_FIFO_SIZE);
In majority of the explicit castings when printing a message they are wrong or
unneeded. Use correct format specifiers to begin with.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-12 8:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 7:58 [PATCH v2 0/2] iio: accel: reject out-of-range FIFO entry counts Shengzhuo Wei
2026-08-12 7:58 ` [PATCH v2 1/2] iio: accel: adxl380: reject out-of-range FIFO entry count Shengzhuo Wei
2026-08-12 7:58 ` [PATCH v2 2/2] iio: accel: adxl367: " Shengzhuo Wei
2026-08-12 8:08 ` Andy Shevchenko [this message]
2026-08-16 0:53 ` Jonathan Cameron
2026-08-17 11:00 ` Andy Shevchenko
2026-08-22 0:21 ` 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=anwqC4tczcdnmF1u@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=marcelo.schmitt@analog.com \
--cc=me@cherr.cc \
--cc=nuno.sa@analog.com \
--cc=ramona.gradinariu@analog.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 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.