Page MenuHomeFreeBSD

linuxkpi: Fix an off-by-one error in the kfifo implementation
ClosedPublic

Authored by markj on Apr 13 2026, 3:05 AM.
Tags
None
Referenced Files
F157414583: D56371.id175405.diff
Thu, May 21, 4:06 AM
Unknown Object (File)
Tue, May 19, 6:26 PM
Unknown Object (File)
Mon, May 18, 12:22 PM
Unknown Object (File)
Mon, May 18, 12:16 PM
Unknown Object (File)
Sun, May 17, 5:09 AM
Unknown Object (File)
Sun, May 17, 5:00 AM
Unknown Object (File)
Sun, May 17, 5:00 AM
Unknown Object (File)
Wed, May 13, 2:21 PM
Subscribers

Details

Summary

"total" is the number of slots in the array, so wraparound needs to be
done when "first" or "last" is greater than or equal to the number of
slots.

Reported by: Stanislav Fort <stanislav.fort@aisle.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Apr 13 2026, 3:05 AM
This revision is now accepted and ready to land.Apr 13 2026, 1:50 PM
bz added a subscriber: bz.

This seems to be correct given we do the check after updating the values.

Do we know what is using the kfifo these days; I am just curious where the report came from?
I know I wrote it for ath10k (which is not connected to the official build yet) and it was only stubs before.
Hmm drm-kmod 6.10 amdgpu uses it for RAS poison events. OK.

In D56371#1290515, @bz wrote:

This seems to be correct given we do the check after updating the values.

Do we know what is using the kfifo these days; I am just curious where the report came from?

I believe it comes from analyzing kernel sources rather than testing any affected drivers.

I know I wrote it for ath10k (which is not connected to the official build yet) and it was only stubs before.
Hmm drm-kmod 6.10 amdgpu uses it for RAS poison events. OK.

Seems to be used by mt76 too.

In D56371#1290515, @bz wrote:

This seems to be correct given we do the check after updating the values.

Do we know what is using the kfifo these days; I am just curious where the report came from?

I believe it comes from analyzing kernel sources rather than testing any affected drivers.

Ah, makes sense :)

I know I wrote it for ath10k (which is not connected to the official build yet) and it was only stubs before.
Hmm drm-kmod 6.10 amdgpu uses it for RAS poison events. OK.

Seems to be used by mt76 too.

For (old) mt7610/12/30 cards. Not even sure if my stash goes so far back. Not compiled on FreeBSD. I do have a 7615 which is worthwhile as on SoCs as well but doesn't use the mt76x02 "lib" parts.