From: Dan Carpenter <dan.carpenter@linaro.org>
To: David Lechner <dlechner@baylibre.com>
Cc: linux-iio@vger.kernel.org
Subject: [bug report] iio: adc: ad7124: change setup reg allocation strategy
Date: Wed, 22 Oct 2025 14:04:55 +0300 [thread overview]
Message-ID: <aPi6V-hcaKReSNWK@stanley.mountain> (raw)
Hello David Lechner,
Commit 9065197e0d41 ("iio: adc: ad7124: change setup reg allocation
strategy") from Sep 23, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/iio/adc/ad7124.c:595 ad7124_release_config_slot()
warn: potential bounds check after use 'channel'
drivers/iio/adc/ad7124.c
587 static void ad7124_release_config_slot(struct ad7124_state *st, u8 channel)
588 {
589 unsigned int slot = st->channels[channel].cfg.cfg_slot;
^^^^^^^^^^^^^^^^^^^^^
590
591 /*
592 * All of these conditions can happen at probe when all channels are
593 * disabled. Otherwise, they should not happen normally.
594 */
--> 595 if (channel >= st->num_channels || slot == AD7124_CFG_SLOT_UNASSIGNED ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
If channel is invalid then we would already have read from out of bounds.
596 st->cfg_slot_use_count[slot] == 0)
597 return;
598
599 st->cfg_slot_use_count[slot]--;
600 st->channels[channel].cfg.cfg_slot = AD7124_CFG_SLOT_UNASSIGNED;
601 }
regards,
dan carpenter
reply other threads:[~2025-10-22 11:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aPi6V-hcaKReSNWK@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=dlechner@baylibre.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.