diff options
| author | Kees Cook <kees@kernel.org> | 2026-11-12 22:55:12 -0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-11-13 16:26:07 +0000 |
| commit | 2a490521d74ac76e5eb3c9a69d928a4c76dd3f78 (patch) | |
| tree | 66f8fdd9dc44ecf31f98b20639b88f022bf0ab14 /tools/perf/scripts/python/bin | |
| parent | 9060f5ba658c9b0a7332be55b3d8abfc2b08618b (diff) | |
spi: axi-spi-engine: Start the program length at zero
spi_engine_optimize_message() allocates the program with kzalloc_flex(),
which sets the __counted_by() counter "length" to the allocated size when
the compiler supports __builtin_counted_by_ref(). The program is then
filled by spi_engine_program_add_cmd(), which increments "length" and
stores at length - 1, expecting it to start at zero as it did when the
program came from kzalloc().
Reset "length" after the allocation, since it is a "usage" counter, not
a "total allocation" counter.
Build tested ARCH=x86_64 defconfig with CONFIG_SPI_AXI_SPI_ENGINE=m and
W=1, with GCC 16.2.0.
Reported-by: Dennis Gilmore <dennis@ausil.us>
Closes: https://lore.kernel.org/all/20261112025252.71375-1-dennis@ausil.us/
Fixes: 69050f8d6d075 ("treewide: Replace kmalloc with kmalloc_obj for non-scalar types")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20261113065508.i.606-kees@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
