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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-06-27 07:26:04 +02:00
parent 5d3fce35c8
commit 23c5f16a4f
+1 -1
View File
@@ -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);