Re: Recent if_wg work: Should DIAGNOSTIC imply KASSERT is available?

From: Kyle Evans <kevans_at_freebsd.org>
Date: Mon, 15 Mar 2021 07:36:51 -0500
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
Received on Mon Mar 15 2021 - 11:37:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC