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>
This commit is contained in:
Christian Schoenebeck 2021-05-16 17:55:34 +02:00
parent 6f56908427
commit 232a4d2c25

View File

@ -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) {