diff mbox series

[v3,5/5] Mini-OS: fix 9pfs response receiving

Message ID 20231121094953.22430-6-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series Mini-OS: preparations for 9pfs in xenstore-stubdom | expand

Commit Message

Jürgen Groß Nov. 21, 2023, 9:49 a.m. UTC
When copying a 9pfs response chunk from the ring buffer across the
ring end, the local ring pointer and length field are not updated
correctly. Fix that.

Fixes: 0924fec1de58 ("Mini-OS: add 9pfs transport layer")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- new patch
---
 9pfront.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Samuel Thibault Nov. 21, 2023, 7:30 p.m. UTC | #1
Juergen Gross, le mar. 21 nov. 2023 10:49:53 +0100, a ecrit:
> When copying a 9pfs response chunk from the ring buffer across the
> ring end, the local ring pointer and length field are not updated
> correctly. Fix that.
> 
> Fixes: 0924fec1de58 ("Mini-OS: add 9pfs transport layer")
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
> V2:
> - new patch
> ---
>  9pfront.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/9pfront.c b/9pfront.c
> index 43c7409f..35c5552b 100644
> --- a/9pfront.c
> +++ b/9pfront.c
> @@ -386,7 +386,9 @@ static void copy_bufs(unsigned char **buf1, unsigned char **buf2,
>              printk("9pfs: short copy (dropping %u bytes)\n", len - *len1);
>              len = *len1;
>          }
> -        memcpy(target, *buf1, *len1);
> +        memcpy(target, *buf1, len);
> +        *buf1 += len;
> +        *len1 -= len;
>      }
>  }
>  
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/9pfront.c b/9pfront.c
index 43c7409f..35c5552b 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -386,7 +386,9 @@  static void copy_bufs(unsigned char **buf1, unsigned char **buf2,
             printk("9pfs: short copy (dropping %u bytes)\n", len - *len1);
             len = *len1;
         }
-        memcpy(target, *buf1, *len1);
+        memcpy(target, *buf1, len);
+        *buf1 += len;
+        *len1 -= len;
     }
 }