On 03.02.26 22:29, Chaney, Ben wrote:


- 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).


MAX_TAP_QUEUES goes away with the series, so INT_MAX is correct limit

(hmm, or may be, simply change queues type to be smaller in QAPI interface?)


+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?


OK. If no other mentions on this thing, I'll change them all (queues, nfds) to 
int.
I don't like these implicit casts too.


--
Best regards,
Vladimir

Reply via email to