Recent if_wg work: Should DIAGNOSTIC imply KASSERT is available?
Kyle Evans
kevans at freebsd.org
Mon Mar 15 12:37:04 UTC 2021
On Mon, Mar 15, 2021 at 6:20 AM David Wolfskill <david at catwhisker.org> wrote:
>
> For my laptop, the kernel config includes GENERIC, does not have
>
> options INVARIANTS
>
> but does have
>
> options DIAGNOSTIC
>
> which has not been a problem until today.
>
> In src/sys/dev/if_wg/wg_noise.c, as of main-n245465-16b2290447de, I see:
>
> ...
> 778 static void
> 779 noise_kdf(uint8_t *a, uint8_t *b, uint8_t *c, const uint8_t *x,
> 780 size_t a_len, size_t b_len, size_t c_len, size_t x_len,
> 781 const uint8_t ck[NOISE_HASH_LEN])
> 782 {
> 783 uint8_t out[BLAKE2S_HASH_SIZE + 1];
> 784 uint8_t sec[BLAKE2S_HASH_SIZE];
> 785
> 786 #ifdef DIAGNOSTIC
> 787 KASSERT(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE 787 &&
> 788 c_len <= BLAKE2S_HASH_SIZE);
> 789 KASSERT(!(b || b_len || c || c_len) || (a && a_len));
> 790 KASSERT(!(c || c_len) || (b && b_len));
> 791 #endif
> 792
> ....
>
> which the compiler helpfully pointed out to me attempts to use KASSERT
> without having it defined.
>
> So: Is DIAGNOSTIC intended to necessarily imply that KASSERT is
> available for use?
>
This is fixed in ff92a03616c5, thanks for the report!
Kyle Evans
More information about the freebsd-current
mailing list