All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Egorenkov <egorenar-dev@posteo.net>
To: linux-kernel@vger.kernel.org
Cc: Alexander Egorenkov <egorenar-dev@posteo.net>
Subject: [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if !CONFIG_NEED_SG_DMA_LENGTH
Date: Sun, 18 Apr 2021 08:14:41 +0000	[thread overview]
Message-ID: <20210418081441.5040-1-egorenar-dev@posteo.net> (raw)

If CONFIG_NEED_SG_DMA_LENGTH is NOT enabled then sg_dma_len() is an alias
for the length field in a SGL. In that case sg_split() wrongly resets
the length of split SGLs to zero after it was set correctly before.

Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
---
 lib/sg_split.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/sg_split.c b/lib/sg_split.c
index 60a0babebf2e..3d9b32084d78 100644
--- a/lib/sg_split.c
+++ b/lib/sg_split.c
@@ -92,7 +92,8 @@ static void sg_split_phys(struct sg_splitter *splitters, const int nb_splits)
 				out_sg->offset = 0;
 			}
 			sg_dma_address(out_sg) = 0;
-			sg_dma_len(out_sg) = 0;
+			if (IS_ENABLED(CONFIG_NEED_SG_DMA_LENGTH))
+				sg_dma_len(out_sg) = 0;
 			in_sg = sg_next(in_sg);
 		}
 		out_sg[-1].length = split->length_last_sg;
-- 
2.31.1


             reply	other threads:[~2021-04-18  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18  8:14 Alexander Egorenkov [this message]
2021-04-19  9:23 ` [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if !CONFIG_NEED_SG_DMA_LENGTH Christoph Hellwig
2021-04-19 14:35   ` Alexander Egorenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210418081441.5040-1-egorenar-dev@posteo.net \
    --to=egorenar-dev@posteo.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.