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, Oct 24, 1:35 PM
Unknown Object (File)
Thu, Oct 24, 1:17 PM
Unknown Object (File)
Thu, Oct 24, 11:58 AM
Unknown Object (File)
Thu, Oct 24, 8:59 AM
Unknown Object (File)
Thu, Oct 24, 8:20 AM
Unknown Object (File)
Thu, Oct 24, 7:52 AM
Unknown Object (File)
Wed, Oct 23, 8:38 AM
Unknown Object (File)
Wed, Oct 2, 6:15 AM
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.