[PATCH v4 12/20] net/txgbe: fix link stability for 25G NIC
Zaiyu Wang
zaiyuwang at trustnetic.com
Wed May 27 13:45:11 CEST 2026
> ## Errors
>
> ### 1. Use-after-free potential in txgbe_e56_rxs_calib_adapt_seq (CORRECTNESS)
No code change.
The return value of txgbe_e56_rxs_osc_init_for_temp_track_range is only used for debugging; the hardware can still continue the subsequent configuration flow even after a timeout. Therefore, we use status |= to record the error for logging but do not abort the sequence.
> ### 2. Resource leak: lock not released on error path (CORRECTNESS)
No code change.
The spinlock is correctly released on all paths, including the TXGBE_ERR_PHY_INIT_NOT_DONE branch. No change is needed.
> ### 3. Missing error propagation to caller (CORRECTNESS)
Fixed. The function now returns TXGBE_ERR_TIMEOUT when the link fails to come up.
> ### 4. Double error return value overwrite (CORRECTNESS)
Fixed by removing the break statements and letting the timeout errors return immediately.
> ### 5. Error code dropped without propagation (CORRECTNESS)
No code change.
A failed temperature read does not affect the subsequent configuration flow; stopping the process would be too aggressive. The function intentionally continues, and the error is only for debug purposes.
> ### 6. Integer overflow in bit shift (CORRECTNESS)
Fixed
> ### 7. Missing bounds check on array size calculation (CORRECTNESS)
Fixed by introducing the RXS_READ_COUNT macro to keep the array size, loop bound, and median calculation always consistent.
> ## Warnings
>
> ### 1. Variables declared but may be read before initialization (STYLE)
Adjusted the declaration of need_reset to the function scope for improved readability.
> ### 2. Missing documentation for complex algorithm (STYLE)
Acknowledged. Adding a high‑level comment for the complex calibration procedure is planned
> ### 3. Magic numbers without named constants (STYLE)
No code change.
These values come directly from the hardware vendor and are located in the base/ layer, which we prefer not to modify without an official update. We will keep them as‑is.
> ## Info
>
> ### 1. Deep nesting in calibration sequence
Considering that this is the hardware configuration code located in base/, for now we will not make change to it.
> ### 2. Possible candidate for helper function
Considering that this is the hardware configuration code located in base/, for now we will not make change to it.
More information about the dev
mailing list