> - if (opts->has_queues && (opts->queues < 0 || opts->queues > UINT_MAX)) {
> + if (opts->has_queues && (opts->queues < 0 || opts->queues > INT_MAX)) {
This change should be part of the first patch (although probably we should use
MAX_TAP_QUEUES instead anyway).
+int net_parse_fds(const char *fds_param, int **fds, int expected_nfds,
+ Error **errp)
+{
+ g_auto(GStrv) fdnames = g_strsplit(fds_param, ":", -1);
+ unsigned nfds = g_strv_length(fdnames);
+ int i;
+
> + if (nfds > INT_MAX) {
> + error_setg(errp, "fds parameter exceeds maximum of %d", INT_MAX);
> + return -1;
This should probably be MAX_TAP_QUEUES also
> + }
> +
> + if (expected_nfds && nfds != expected_nfds) {
> + error_setg(errp, "expected %u socket fds, got %u", expected_nfds, nfds);
> + return -1;
> + }
> +
> + *fds = g_new(int, nfds);
> +
> + for (i = 0; i < nfds; i++) {
> + (*fds)[i] = monitor_fd_param(monitor_cur(), fdnames[i], errp);
> + if ((*fds)[i] == -1) {
> + net_free_fds(*fds, i);
> + *fds = NULL;
> + return -1;
> + }
> + }
> +
> + return nfds;
> +}
I don't like the implicit cast to signed here.
Is it possible to be more consistent with typing?
Thanks,
Ben