On 2/3/26 8:10 PM, Chaney, Ben wrote:
> 
>> In for-loop in net_init_af_xdp, we do nc->queue_index = i,
>> where is is int64_t for 0 to queues-1, and nc->queue_index is
>> unsigned int.
> 
> 
>> Also in parse_socket_fds, g_strv_length() returns guint which
>> is equivalent to unsigned int.
> 
> 
>> Let's simply use unsigned int type for queues, and update
>> the check appropriately.
> 
> 
> I have some concerns about this patch queues is generally signed,
> so negative values can be used for error handling. We should
> probably be consistent with this.
> 
> 
>> - queues = opts->has_queues ? opts->queues : 1;
>> - if (queues < 1) {
>> + if (opts->has_queues && (opts->queues < 0 || opts->queues > UINT_MAX)) {
>> error_setg(errp, "invalid number of queues (%" PRIi64 ") for '%s'",
>> - queues, opts->ifname);
>> + opts->queues, opts->ifname);
>> return -1;
>> }
> 
> Perhaps the condition here should be opts->queues > MAX_TAP_QUEUES
> instead of UINT_MAX

I wonder why would we use MAX_TAP_QUEUES for something that isn't
a tap interface?  It's also not defined here, would be a bit awkward
to export.

Best regards, Ilya Maximets.

Reply via email to