lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250724120211.30050-1-hept.hept.hept@gmail.com>
Date: Thu, 24 Jul 2025 20:02:11 +0800
From: Pengtao He <hept.hept.hept@...il.com>
To: edumazet@...gle.com
Cc: aleksander.lobakin@...el.com,
	almasrymina@...gle.com,
	davem@...emloft.net,
	ebiggers@...gle.com,
	hept.hept.hept@...il.com,
	horms@...nel.org,
	kerneljasonxing@...il.com,
	kuba@...nel.org,
	linux-kernel@...r.kernel.org,
	mhal@...x.co,
	netdev@...r.kernel.org,
	pabeni@...hat.com,
	willemb@...gle.com
Subject: Re: [PATCH net-next v2] net/core: fix wrong return value in __splice_segment

> >
> > Return true immediately when the last segment is processed,
> > avoid to walking once more in the frags loop.
> >
> > Signed-off-by: Pengtao He <hept.hept.hept@...il.com>
> > ---
> > v2->v1:
> > Correct the commit message and target tree.
> > v1:
> > https://lore.kernel.org/netdev/20250723063119.24059-1-hept.hept.hept@gmai=
> l.com/
> > ---
> >  net/core/skbuff.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> > index ee0274417948..cc3339ab829a 100644
> > --- a/net/core/skbuff.c
> > +++ b/net/core/skbuff.c
> > @@ -3114,6 +3114,9 @@ static bool __splice_segment(struct page *page, uns=
> igned int poff,
> >                 *len -=3D flen;
> >         } while (*len && plen);
> >
> > +       if (!*len)
> > +               return true;
> > +
> >         return false;
> >  }
> >
> 
> Condition is evaluated twice. What about this instead ?
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index ee0274417948e0eb121792a400a0455884c92e56..23b776cd98796cf8eb4d19868a0=
> 506423226914d
> 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3112,7 +3112,9 @@ static bool __splice_segment(struct page *page,
> unsigned int poff,
>                 poff +=3D flen;
>                 plen -=3D flen;
>                 *len -=3D flen;
> -       } while (*len && plen);
> +               if (!*len)
> +                       return true;
> +       } while (plen);
> 
>         return false;
>  }
> 
Ok, this is better.

Thanks.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ