[PATCH 2/2] lib: scatterlist: Fix incorrect SG offset in sg_split_phys()

From: Alexander Egorenkov
Date: Sun Apr 18 2021 - 10:34:47 EST


sg_split_phys() incorrectly resets the offset of all split SGLs but the
first one to 0. This is wrong because one of the original SGLs might have
the offset != 0.

Signed-off-by: Alexander Egorenkov <egorenar-dev@xxxxxxxxxx>
---
lib/sg_split.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/lib/sg_split.c b/lib/sg_split.c
index 0920affd12ee..4e91547a898d 100644
--- a/lib/sg_split.c
+++ b/lib/sg_split.c
@@ -89,8 +89,6 @@ static void sg_split_phys(struct sg_splitter *splitters, const int nb_splits)
if (!j) {
out_sg->offset += split->skip_sg0;
out_sg->length -= split->skip_sg0;
- } else {
- out_sg->offset = 0;
}
sg_dma_address(out_sg) = 0;
if (IS_ENABLED(CONFIG_NEED_SG_DMA_LENGTH))
--
2.31.1