Page MenuHomeFreeBSD

Replace panic() with KASSERT in subr_blist.c
ClosedPublic

Authored by dougm on May 10 2019, 3:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 9:53 AM
Unknown Object (File)
Sat, Nov 16, 10:45 AM
Unknown Object (File)
Fri, Nov 15, 12:31 AM
Unknown Object (File)
Thu, Nov 14, 2:50 PM
Unknown Object (File)
Sun, Nov 3, 5:50 PM
Unknown Object (File)
Sun, Nov 3, 4:24 PM
Unknown Object (File)
Oct 28 2024, 5:20 AM
Unknown Object (File)
Oct 27 2024, 10:35 PM
Subscribers

Details

Summary

Replace panic() with KASSERT() and provide more useful information when failure happens.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

subr_blist.c
123 ↗(On Diff #57265)

Did you consider using assert(3)?

289 ↗(On Diff #57265)

Style: extra space after KASSERT.

Remove extra space.

subr_blist.c
123 ↗(On Diff #57265)

The change from panic to KASSERT was driven entirely by my other mentor. I considered nothing.

subr_blist.c
290 ↗(On Diff #57269)

What is maxcount ?

334 ↗(On Diff #57269)

We ise %jx and uintmax_t for such cases. It is probably fine to cast count to int, but if the value is corrupted, it would hide the information by truncating.

Replace maxcount with count, %llx with %jx, and (long long) with (uintmax_t).

subr_blist.c
123 ↗(On Diff #57265)

Mark means that you can implement KASSERT using assert(3), he does not suggest to use assert instead of KASSERT.

Use assert() for KASSERT in the blist test program.

This revision is now accepted and ready to land.May 10 2019, 5:51 PM
This revision was automatically updated to reflect the committed changes.