aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p.c
diff options
context:
space:
mode:
authorChristian Schoenebeck <qemu_oss@crudebyte.com>2021-05-16 17:55:34 +0200
committerChristian Schoenebeck <qemu_oss@crudebyte.com>2021-07-05 13:03:16 +0200
commit232a4d2c25c3a83e148116a15f992f728c3579e6 (patch)
tree10edbcf83df08d5ec9df57406255b8fab0cbcb41 /hw/9pfs/9p.c
parent6f569084277dc7ae351141cfa6ad3649e92a1390 (diff)
downloadqemu-232a4d2c25c3a83e148116a15f992f728c3579e6.zip
qemu-232a4d2c25c3a83e148116a15f992f728c3579e6.tar.gz
qemu-232a4d2c25c3a83e148116a15f992f728c3579e6.tar.bz2
9pfs: simplify v9fs_walk()
There is only one comparison between nwnames and P9_MAXWELEM required. Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by: Greg Kurz <groug@kaod.org> Message-Id: <E1liKiz-0006BC-Ja@lizzy.crudebyte.com>
Diffstat (limited to 'hw/9pfs/9p.c')
-rw-r--r--hw/9pfs/9p.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 0fa776a..89aa07d 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1739,7 +1739,11 @@ static void coroutine_fn v9fs_walk(void *opaque)
trace_v9fs_walk(pdu->tag, pdu->id, fid, newfid, nwnames);
- if (nwnames && nwnames <= P9_MAXWELEM) {
+ if (nwnames > P9_MAXWELEM) {
+ err = -EINVAL;
+ goto out_nofid;
+ }
+ if (nwnames) {
wnames = g_new0(V9fsString, nwnames);
qids = g_new0(V9fsQID, nwnames);
for (i = 0; i < nwnames; i++) {
@@ -1753,9 +1757,6 @@ static void coroutine_fn v9fs_walk(void *opaque)
}
offset += err;
}
- } else if (nwnames > P9_MAXWELEM) {
- err = -EINVAL;
- goto out_nofid;
}
fidp = get_fid(pdu, fid);
if (fidp == NULL) {