Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2021 07:36:51 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        current <current@freebsd.org>
Subject:   Re: Recent if_wg work: Should DIAGNOSTIC imply KASSERT is available?
Message-ID:  <CACNAnaFOVOa2kctAqaWvEtfEKTHbyPmBVJN8_0LMTOx7kWdUVw@mail.gmail.com>
In-Reply-To: <YE9DCkulTOWAaPuh@albert.catwhisker.org>
References:  <YE9DCkulTOWAaPuh@albert.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 15, 2021 at 6:20 AM David Wolfskill <david@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFOVOa2kctAqaWvEtfEKTHbyPmBVJN8_0LMTOx7kWdUVw>