Skip to content

Coverity fixes - #1813

Merged
troglobit merged 2 commits into
mainfrom
coverity-fixes
Nov 22, 2026
Merged

troglobit merged 2 commits into
mainfrom
coverity-fixes

Conversation

@troglobit

Copy link
Copy Markdown
Contributor

Description

Fixes to this weekend's Coverity findings, all in the latest QoS updates.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

Coverity flags a division by zero in gen_cbs(), CID 566178, where the
idle slope is scaled by the cycle over the gate's open time.  Validation
rejects a credit-based shaper on a gate that never opens, but nothing in
gen_cbs() itself says so.

Leave the slope unscaled when the open time is zero.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Coverity flags the Mbps to bps conversion in qos_port_rate() and
qos_link_rate(), CID 566177 and 566179.  The speed is a long read from
sysfs or parsed from ethtool output, so the tool sees a value that may
be negative, or large enough to wrap, when cast and multiplied.

Convert in one place, qos_bps(), which falls back to a gigabit for a
speed outside 1 Mbps to 1 Tbps.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit
troglobit requested a review from mattiaswal November 21, 2026 16:55
@troglobit troglobit added the ci:main Build default defconfig, not minimal label Nov 21, 2026
@troglobit

Copy link
Copy Markdown
Contributor Author

Failures on Styx seem unrelated, after analysis by "a friend", so merging.

@troglobit
troglobit merged commit 6409114 into main Nov 22, 2026
15 of 17 checks passed
@troglobit
troglobit deleted the coverity-fixes branch November 22, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:main Build default defconfig, not minimal

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants