]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()
authorGabor Juhos <j4g8y7@gmail.com>
Mon, 11 Aug 2025 08:30:42 +0000 (10:30 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 28 Aug 2025 12:23:20 +0000 (14:23 +0200)
commit5b5dc7db5a8dc2c221526acf81b323ec1f972d0f
tree05642141fc34fed2f3ccee154147cca5fa01682a
parent3ea299d3dccdb8554057d0a87552e7673baea95d
mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()

Since commit ddaad4ad774d ("mtd: nand: qpic_common: prevent out of
bounds access of BAM arrays"), the {cmd,data}_sgl_nitems members in
the 'bam_transaction' structure are containing the number of elements
in the cmd/data scatter-gather lists.

Change the qcom_clear_bam_transaction() function to use these numbers
while reinitializing the sg lists instead of recomputing the number of
elements to make it less error prone.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Acked-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/qpic_common.c