From 23c5f16a4f2179c6f19a65a252eb435840f7f021 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 27 Jun 2026 07:26:04 +0200 Subject: [PATCH] confd: guard NULL forced PMD in fixed-speed ethtool config In netdag_gen_ethtool_autoneg() the unmapped and "exactly one entry" checks already guarantee a forced PMD link mode is selected, but Coverity cannot see the correlation and flags the later deref. Fold !forced into the entry-count guard to make the invariant explicit. Fixes Coverity CID 561388. Signed-off-by: Joachim Wiberg --- src/confd/src/ieee802-ethernet-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/confd/src/ieee802-ethernet-interface.c b/src/confd/src/ieee802-ethernet-interface.c index 18d03bce..87eed1c7 100644 --- a/src/confd/src/ieee802-ethernet-interface.c +++ b/src/confd/src/ieee802-ethernet-interface.c @@ -237,7 +237,7 @@ static int netdag_gen_ethtool_autoneg(struct dagger *net, struct lyd_node *cif) err = -EINVAL; goto out; } - if (n != 1) { + if (n != 1 || !forced) { sr_session_set_error_message(net->session, "%s: auto-negotiation/enable=false requires exactly one " "advertised-pmd-types entry (have %d)", ifname, n);