From: Alexander Egorenkov <egorenar@posteo.net>
To: Christoph Hellwig <hch@infradead.org>,
Alexander Egorenkov <egorenar-dev@posteo.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if !CONFIG_NEED_SG_DMA_LENGTH
Date: Mon, 19 Apr 2021 14:35:50 +0000 [thread overview]
Message-ID: <87y2de4a0p.fsf@posteo.net> (raw)
In-Reply-To: <20210419092325.GA3215674@infradead.org>
Christoph Hellwig <hch@infradead.org> writes:
> On Sun, Apr 18, 2021 at 08:14:41AM +0000, Alexander Egorenkov wrote:
>> 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.
>
> Why is this routine messing with sg_dma_address and
> sg_dma_lensg_dma_lensg_dma_len at all? This whole sg_spli() routine
> seems rather dangerous because ownership and state of the DMA mapping is
> entirely unclear.
If i understood it correctly, then sg_split_phys() creates a new SGL
from the given one, so it makes sense to initialize DMA fields of the
new SGL. sg_split() allows one to split the given SGL into multiple ones
and the original one doesn't have to be dma-mapped which is indicated by the
parameter in_mapped_nents > 0.
Regards
Alex
prev parent reply other threads:[~2021-04-19 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-18 8:14 [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if !CONFIG_NEED_SG_DMA_LENGTH Alexander Egorenkov
2021-04-19 9:23 ` Christoph Hellwig
2021-04-19 14:35 ` Alexander Egorenkov [this message]
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=87y2de4a0p.fsf@posteo.net \
--to=egorenar@posteo.net \
--cc=egorenar-dev@posteo.net \
--cc=hch@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox