mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: Jonathan Cameron <jic23@kernel.org>, Remi Buisson <remi.buisson@tdk.com>
Cc: "Andy Shevchenko" <andy@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: imu: inv_icm45600: clamp the device-reported FIFO sample count
Date: Mon, 22 Jun 2026 08:55:34 +0000	[thread overview]
Message-ID: <20260622085527.67500-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <20260621190804.04894168@jic23-huawei>

On 2026-06-21, Jonathan Cameron wrote:
> So could we just do this instead?
>     st->fifo.count = min(fifo_nb * packet_size, INV_ICM45600_FIFO_SIZE_MAX);

Yes, cleaner -- and safe here: fifo_nb isn't used past that line (the read, the
one-by-one fallback and the decode loop all bound on st->fifo.count), so
clamping the byte count is enough. fifo_nb is size_t and packet_size ssize_t, so
the multiply is 64-bit with no narrowing before the min. v4 will use it.

> can we actually use the define in the allocation in _core.c

Will do. It's devm_kzalloc(dev, 8192, ...) today and INV_ICM45600_FIFO_SIZE_MAX
is SZ_8K, so it's a no-op rename that ties the allocation to the clamp; folded
into the same patch with a changelog note.

v4 shortly.

Bryam


      reply	other threads:[~2026-06-22  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  1:57 Bryam Vargas via B4 Relay
2026-06-17 10:18 ` Andy Shevchenko
2026-06-21 18:08 ` Jonathan Cameron
2026-06-22  8:55   ` Bryam Vargas [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=20260622085527.67500-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=remi.buisson@tdk.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

all inboxes | Powered by JetHome®