From: Andrew Morton <akpm@linux-foundation.org>
To: T Pratham <t-pratham@ti.com>
Cc: Jens Axboe <axboe@kernel.dk>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Kamlesh Gurudasani <kamlesh@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
Praneeth Bajjuri <praneeth@ti.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib: scatterlist: Fix sg_split_phys to preserve original scatterlist offsets
Date: Wed, 19 Mar 2025 18:46:05 -0700 [thread overview]
Message-ID: <20250319184605.809fc9ce3b169478102b9313@linux-foundation.org> (raw)
In-Reply-To: <20250319111437.1969903-1-t-pratham@ti.com>
On Wed, 19 Mar 2025 16:44:38 +0530 T Pratham <t-pratham@ti.com> wrote:
> The split_sg_phys function was incorrectly setting the offsets of all
> scatterlist entries (except the first) to 0. Only the first scatterlist
> entry's offset and length needs to be modified to account for the skip.
> Setting the rest entries' offsets to 0 could lead to incorrect data
> access.
>
> This patch removes the offending code, ensuring that the page offsets
> in the input scatterlist are preserved in the output scatterlist.
Is this merely from code inspection, or is this issues known to have
observable runtime effects?
If the latter, please provide a complete description.
>
> ...
>
> --- a/lib/sg_split.c
> +++ b/lib/sg_split.c
> @@ -88,8 +88,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;
> sg_dma_len(out_sg) = 0;
> --
> 2.34.1
next prev parent reply other threads:[~2025-03-20 1:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 11:14 [PATCH] lib: scatterlist: Fix sg_split_phys to preserve original scatterlist offsets T Pratham
2025-03-20 1:46 ` Andrew Morton [this message]
2025-03-20 4:58 ` T Pratham
2025-03-26 8:43 ` T Pratham
2025-03-27 18:50 ` Andrew Morton
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=20250319184605.809fc9ce3b169478102b9313@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=kamlesh@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=praneeth@ti.com \
--cc=robert.jarzmik@free.fr \
--cc=t-pratham@ti.com \
--cc=vigneshr@ti.com \
/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