netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: skb_to_sgvec() causes sg_pcopy_to_buffer() wrong
@ 2019-06-21  7:37 Hayes Wang
  0 siblings, 0 replies; only message in thread
From: Hayes Wang @ 2019-06-21  7:37 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, nic_swsd

> Use skb_to_sgvec() to set scatter list, and sometime we would get a
> sg->offset which is more than PAGE_SIZE. Call sg_pcopy_to_buffer()
> with this scatter list would get wrong data.
> 
> In sg_miter_get_next_page(), you would get wrong miter->__remaining,
> when the sg->offset is more than PAGE_SIZE.
> 
> static bool sg_miter_get_next_page(struct sg_mapping_iter *miter)
> {
> 	if (!miter->__remaining) {
> 		struct scatterlist *sg;
> 		unsigned long pgoffset;
> 
> 		if (!__sg_page_iter_next(&miter->piter))
> 			return false;
> 
> 		sg = miter->piter.sg;
> 		pgoffset = miter->piter.sg_pgoffset;
> 
> 		miter->__offset = pgoffset ? 0 : sg->offset;
> 		miter->__remaining = sg->offset + sg->length -
> 				(pgoffset << PAGE_SHIFT) - miter->__offset;
> 		miter->__remaining = min_t(unsigned long, miter->__remaining,
> 					   PAGE_SIZE - miter->__offset);
> 	}
> 
> 	return true;
> }

Excuse me. The following patch could solve my problem.

https://patchwork.kernel.org/patch/11000549/

Best Regards,
Hayes


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-21  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21  7:37 skb_to_sgvec() causes sg_pcopy_to_buffer() wrong Hayes Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).