mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
mmc: mmci: stm32: correctly check all elements of sg list
commit0d319dd5a2upstream. Use sg and not data->sg when checking sg list elements. Else only the first element alignment is checked. The last element should be checked the same way, for_each_sg already set sg to sg_next(sg). Fixes:46b723dd86("mmc: mmci: add stm32 sdmmc variant") Cc: stable@vger.kernel.org Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Link: https://lore.kernel.org/r/20220317111944.116148-2-yann.gautier@foss.st.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
41a519c05b
commit
029b417073
|
|
@ -62,8 +62,8 @@ static int sdmmc_idma_validate_data(struct mmci_host *host,
|
||||||
* excepted the last element which has no constraint on idmasize
|
* excepted the last element which has no constraint on idmasize
|
||||||
*/
|
*/
|
||||||
for_each_sg(data->sg, sg, data->sg_len - 1, i) {
|
for_each_sg(data->sg, sg, data->sg_len - 1, i) {
|
||||||
if (!IS_ALIGNED(data->sg->offset, sizeof(u32)) ||
|
if (!IS_ALIGNED(sg->offset, sizeof(u32)) ||
|
||||||
!IS_ALIGNED(data->sg->length, SDMMC_IDMA_BURST)) {
|
!IS_ALIGNED(sg->length, SDMMC_IDMA_BURST)) {
|
||||||
dev_err(mmc_dev(host->mmc),
|
dev_err(mmc_dev(host->mmc),
|
||||||
"unaligned scatterlist: ofst:%x length:%d\n",
|
"unaligned scatterlist: ofst:%x length:%d\n",
|
||||||
data->sg->offset, data->sg->length);
|
data->sg->offset, data->sg->length);
|
||||||
|
|
@ -71,7 +71,7 @@ static int sdmmc_idma_validate_data(struct mmci_host *host,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_ALIGNED(data->sg->offset, sizeof(u32))) {
|
if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
|
||||||
dev_err(mmc_dev(host->mmc),
|
dev_err(mmc_dev(host->mmc),
|
||||||
"unaligned last scatterlist: ofst:%x length:%d\n",
|
"unaligned last scatterlist: ofst:%x length:%d\n",
|
||||||
data->sg->offset, data->sg->length);
|
data->sg->offset, data->sg->length);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user