diff mbox series

[3/3] Mini-OS: fix 9pfs stat receive format

Message ID 20231101090024.28934-4-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series Mini-OS: preparations for 9pfs in xenstore-stubdom | expand

Commit Message

Jürgen Groß Nov. 1, 2023, 9 a.m. UTC
The format string of the received data for the 9pfs stat command is
missing the initial 2 byte total length specifier. Add it.

Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 9pfront.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jason Andryuk Nov. 1, 2023, 1:25 p.m. UTC | #1
On Wed, Nov 1, 2023 at 5:14 AM Juergen Gross <jgross@suse.com> wrote:
>
> The format string of the received data for the 9pfs stat command is
> missing the initial 2 byte total length specifier. Add it.
>
> Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront")
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  9pfront.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/9pfront.c b/9pfront.c
> index 5da8a365..43c7409f 100644
> --- a/9pfront.c
> +++ b/9pfront.c
> @@ -711,6 +711,7 @@ static int p9_create(struct dev_9pfs *dev, uint32_t fid, char *path,
>  static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat)
>  {
>      struct req *req = get_free_req(dev);
> +    uint16_t total;
>      int ret;
>
>      if ( !req )
> @@ -719,10 +720,10 @@ static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat)
>      memset(stat, 0, sizeof(*stat));
>      req->cmd = P9_CMD_STAT;
>      send_9p(dev, req, "U", fid);
> -    rcv_9p(dev, req, "uuUQUUULSSSSSUUU", &stat->size, &stat->type, &stat->dev,
> -           stat->qid, &stat->mode, &stat->atime, &stat->mtime, &stat->length,
> -           &stat->name, &stat->uid, &stat->gid, &stat->muid, &stat->extension,
> -           &stat->n_uid, &stat->n_gid, &stat->n_muid);
> +    rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type,
> +           &stat->dev, stat->qid, &stat->mode, &stat->atime, &stat->mtime,
> +           &stat->length, &stat->name, &stat->uid, &stat->gid, &stat->muid,
> +           &stat->extension, &stat->n_uid, &stat->n_gid, &stat->n_muid);

total is unused by the linux frontend end as well.  Looks like QEMU
hard codes the value as 0.

Reviewed-by: Jason Andryuk <jandryuk@gmail.com>

Thanks,
Jason
diff mbox series

Patch

diff --git a/9pfront.c b/9pfront.c
index 5da8a365..43c7409f 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -711,6 +711,7 @@  static int p9_create(struct dev_9pfs *dev, uint32_t fid, char *path,
 static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat)
 {
     struct req *req = get_free_req(dev);
+    uint16_t total;
     int ret;
 
     if ( !req )
@@ -719,10 +720,10 @@  static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat)
     memset(stat, 0, sizeof(*stat));
     req->cmd = P9_CMD_STAT;
     send_9p(dev, req, "U", fid);
-    rcv_9p(dev, req, "uuUQUUULSSSSSUUU", &stat->size, &stat->type, &stat->dev,
-           stat->qid, &stat->mode, &stat->atime, &stat->mtime, &stat->length,
-           &stat->name, &stat->uid, &stat->gid, &stat->muid, &stat->extension,
-           &stat->n_uid, &stat->n_gid, &stat->n_muid);
+    rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type,
+           &stat->dev, stat->qid, &stat->mode, &stat->atime, &stat->mtime,
+           &stat->length, &stat->name, &stat->uid, &stat->gid, &stat->muid,
+           &stat->extension, &stat->n_uid, &stat->n_gid, &stat->n_muid);
 
     ret = req->result;