|SUCCESS| net/tap: avoid using netlink socket if closed
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Mon Apr 6 13:27:16 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162855
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-06
I'll review this patch against the DPDK coding standards and contribution guidelines.
```
commit 20260403192635.320320-1-stephen at networkplumber.org
Author: Stephen Hemminger <stephen at networkplumber.org>
Subject: [PATCH] net/tap: avoid using netlink socket if closed
This patch addresses a Coverity issue where nlsk_fd could be negative
when passed to tap_nl_set_flags() during device close.
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index a5d460a0b3..ba9aef74c0 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1124,7 +1124,7 @@ tap_dev_close(struct rte_eth_dev *dev)
> }
> }
>
> - if (internals->remote_if_index) {
> + if (internals->remote_if_index != 0 && internals->nlsk_fd != -1) {
In the modified condition, should the check use the explicit form
'internals->remote_if_index != 0' for both comparisons for consistency?
The coding style guide section 3.2.1 states that "Comparisons to zero or
NULL should be explicit unless the value is a boolean." While the original
code had an implicit comparison, this change makes it partially explicit.
For consistency, could this be written as both explicit comparisons?
Does the order of checks matter here? If nlsk_fd is checked first and
remote_if_index second, would that be more efficient due to short-circuit
evaluation when the socket is already closed (-1)?
> /* Restore initial remote state */
> int ret = tap_nl_set_flags(internals->nlsk_fd, internals->remote_if_index,
> internals->remote_initial_flags, 1);
```
More information about the test-report
mailing list