On Mon, Sep 14, 2026 at 04:50:45PM +0200, Jonas Rebmann wrote: > SPI_IOC_MESSAGE() submits a single SPI message containing one or more > transfers. Introduce an option to allow splitting the message into > multiple transfers. > + size_t bytes_per_word = DIV_ROUND_UP(bits, 8); > + int effective_transfers = min_t(int, transfers, DIV_ROUND_UP(len, bytes_per_word)); We divide by this and nothing stops us triggering a divide by 0. > + struct spi_ioc_transfer tr[effective_transfers]; This could easily get very big if someone decides to test lots of small transfers, it's probably worth moving off the stack at this point. > + size_t len_per_transfer = ALIGN(DIV_ROUND_UP(len, effective_transfers), bytes_per_word); The kernel's ALIGN() macro only works for powers of two.