From: Manos Pitsidianakis <el13635@mail.ntua.gr>
To: Tobias Schramm <tobleminer@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/1] Add support for custom fmasks/dmasks in 9ps mapped mode
Date: Sun, 18 Jun 2017 16:57:50 +0300 [thread overview]
Message-ID: <20170618135750.2sxnenwtmcwyhls3@postretch> (raw)
In-Reply-To: <20170618082813.8091-2-tobleminer@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
On Sun, Jun 18, 2017 at 10:28:13AM +0200, Tobias Schramm wrote:
>@@ -1469,6 +1472,28 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
>
> fse->path = g_strdup(path);
>
>+ fse->fmask = SM_LOCAL_MODE_BITS;
>+ if (fmask) {
>+ mask = strtol(fmask, NULL, 0);
(Use qemu_strtol(), or maybe parse_uint() since it has to be positive)
If a mode without the '0' prefix is supplied (as required by strtol to
parse an octal), the input will be parsed as a decimal and will result
in a wrong value. Also, maybe you should check for mask > 0777 and for
negative input as well instead of &ing.
>+ if((!mask || mask == LONG_MIN || mask == LONG_MAX) && errno)
>+ {
>+ error_report("Invalid fmask %s specified", fmask);
>+ return -1;
>+ }
>+ fse->fmask = ((mode_t)mask) & 0777;
>+ }
>+
>+ fse->dmask = SM_LOCAL_DIR_MODE_BITS;
>+ if (dmask) {
>+ mask = strtol(dmask, NULL, 0);
>+ if((!mask || mask == LONG_MIN || mask == LONG_MAX) && errno)
>+ {
>+ error_report("Invalid dmask %s specified", dmask);
>+ return -1;
>+ }
>+ fse->dmask = ((mode_t)mask) & 0777;
Same here.
>+ }
>+
> return 0;
> }
>
>diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
>index 96d2683348..40290dbade 100644
>--- a/hw/9pfs/9p.c
>+++ b/hw/9pfs/9p.c
>@@ -3533,6 +3533,9 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp)
>
> s->ops = fse->ops;
>
>+ s->ctx.fmask = fse->fmask;
>+ s->ctx.dmask = fse->dmask;
>+
> s->fid_list = NULL;
> qemu_co_rwlock_init(&s->rename_lock);
>
>--
>2.13.1
>
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-18 13:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-18 8:28 [Qemu-devel] [PATCH 0/1] Add fmask/dmask option for 9p mapped mode Tobias Schramm
2017-06-18 8:28 ` [Qemu-devel] [PATCH 1/1] Add support for custom fmasks/dmasks in 9ps " Tobias Schramm
2017-06-18 13:57 ` Manos Pitsidianakis [this message]
2017-06-27 20:01 ` Eric Blake
2017-06-18 12:37 ` [Qemu-devel] [PATCH 0/1] Add fmask/dmask option for 9p " no-reply
2017-06-18 13:47 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170618135750.2sxnenwtmcwyhls3@postretch \
--to=el13635@mail.ntua.gr \
--cc=qemu-devel@nongnu.org \
--cc=tobleminer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).