Re: [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents
From: Jason Gunthorpe
Date: Tue Aug 24 2021 - 15:12:56 EST
On Tue, Aug 24, 2021 at 05:25:30PM +0300, Maor Gottlieb wrote:
> @@ -514,11 +531,13 @@ struct scatterlist *sg_alloc_append_table_from_pages(struct sg_table *sgt,
> offset = 0;
> cur_page = j;
> }
> - sgt->nents += added_nents;
> + sgt_append->sgt.nents += added_nents;
> + sgt_append->sgt.orig_nents = sgt_append->sgt.nents;
> + sgt_append->prv = s;
Why is nents being touched here?
Shouldn't it just be
sgt_append->sgt.orig_nents += added_nents;
sgt_append->prv = s;
?
Let me know I can fix it
Jason