* [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()
@ 2025-08-11 8:30 Gabor Juhos
2025-08-11 10:36 ` Konrad Dybcio
2025-09-01 12:28 ` Miquel Raynal
0 siblings, 2 replies; 3+ messages in thread
From: Gabor Juhos @ 2025-08-11 8:30 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-arm-msm, linux-kernel, Gabor Juhos
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>
---
drivers/mtd/nand/qpic_common.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/qpic_common.c b/drivers/mtd/nand/qpic_common.c
index 8e604cc22ca310159edf4d8dbc2f6a82d5119eb4..db6c46a6fe01c71e8bb0379eb1f289c7e56701c9 100644
--- a/drivers/mtd/nand/qpic_common.c
+++ b/drivers/mtd/nand/qpic_common.c
@@ -89,10 +89,8 @@ void qcom_clear_bam_transaction(struct qcom_nand_controller *nandc)
memset(&bam_txn->bam_positions, 0, sizeof(bam_txn->bam_positions));
bam_txn->last_data_desc = NULL;
- sg_init_table(bam_txn->cmd_sgl, nandc->max_cwperpage *
- QPIC_PER_CW_CMD_SGL);
- sg_init_table(bam_txn->data_sgl, nandc->max_cwperpage *
- QPIC_PER_CW_DATA_SGL);
+ sg_init_table(bam_txn->cmd_sgl, bam_txn->cmd_sgl_nitems);
+ sg_init_table(bam_txn->data_sgl, bam_txn->data_sgl_nitems);
reinit_completion(&bam_txn->txn_done);
}
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250809-qpic_common-sgl-nitems-9ce54a6d0c25
Best regards,
--
Gabor Juhos <j4g8y7@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()
2025-08-11 8:30 [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table() Gabor Juhos
@ 2025-08-11 10:36 ` Konrad Dybcio
2025-09-01 12:28 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2025-08-11 10:36 UTC (permalink / raw)
To: Gabor Juhos, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, linux-arm-msm, linux-kernel
On 8/11/25 10:30 AM, Gabor Juhos wrote:
> 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>
Konrad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()
2025-08-11 8:30 [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table() Gabor Juhos
2025-08-11 10:36 ` Konrad Dybcio
@ 2025-09-01 12:28 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-09-01 12:28 UTC (permalink / raw)
To: Richard Weinberger, Vignesh Raghavendra, Gabor Juhos
Cc: linux-mtd, linux-arm-msm, linux-kernel
On Mon, 11 Aug 2025 10:30:42 +0200, Gabor Juhos wrote:
> 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.
>
> [...]
Applied to nand/next, thanks!
[1/1] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table()
commit: 5b5dc7db5a8dc2c221526acf81b323ec1f972d0f
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-01 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 8:30 [PATCH] mtd: nand: qpic_common: use {cmd,data}_sgl_nitems for sg_init_table() Gabor Juhos
2025-08-11 10:36 ` Konrad Dybcio
2025-09-01 12:28 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).