[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y2de4a0p.fsf@posteo.net>
Date: Mon, 19 Apr 2021 14:35:50 +0000
From: Alexander Egorenkov <egorenar@...teo.net>
To: Christoph Hellwig <hch@...radead.org>,
Alexander Egorenkov <egorenar-dev@...teo.net>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if
!CONFIG_NEED_SG_DMA_LENGTH
Christoph Hellwig <hch@...radead.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
Powered by blists - more mailing lists