diff mbox series

[net-next] net: fix signedness bug in skb_splice_from_iter()

Message ID 99284df8-9190-4deb-ad7c-c0557614a1c8@kili.mountain (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: fix signedness bug in skb_splice_from_iter() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 10 this patch: 10
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter May 26, 2023, 11:46 a.m. UTC
The "len" variable needs to be signed for the error handling to work
correctly.

Fixes: 2e910b95329c ("net: Add a function to splice pages into an skbuff for MSG_SPLICE_PAGES")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 net/core/skbuff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Howells May 26, 2023, 1:17 p.m. UTC | #1
Dan Carpenter <dan.carpenter@linaro.org> wrote:

>  	while (iter->count > 0) {
>  		ssize_t space, nr;
> -		size_t off, len;
> +		ssize_t len;
> +		size_t off;

Good point, but why not just move len onto the preceding line?

 	while (iter->count > 0) {
-		ssize_t space, nr;
-		size_t off, len;
+		ssize_t space, nr, len;
+		size_t off;

David
Dan Carpenter May 26, 2023, 1:20 p.m. UTC | #2
On Fri, May 26, 2023 at 02:17:38PM +0100, David Howells wrote:
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
> 
> >  	while (iter->count > 0) {
> >  		ssize_t space, nr;
> > -		size_t off, len;
> > +		ssize_t len;
> > +		size_t off;
> 
> Good point, but why not just move len onto the preceding line?
> 
>  	while (iter->count > 0) {
> -		ssize_t space, nr;
> -		size_t off, len;
> +		ssize_t space, nr, len;
> +		size_t off;

Sure.  Will do.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 653abd8a6975..57a8ba81ab39 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6932,7 +6932,8 @@  ssize_t skb_splice_from_iter(struct sk_buff *skb, struct iov_iter *iter,
 
 	while (iter->count > 0) {
 		ssize_t space, nr;
-		size_t off, len;
+		ssize_t len;
+		size_t off;
 
 		ret = -EMSGSIZE;
 		space = frag_limit - skb_shinfo(skb)->nr_frags;