Re: [PATCH 4/4] kmsan: add memsetXX tests
From: Alexander Potapenko
Date: Thu Mar 02 2023 - 09:14:48 EST
On Thu, Mar 2, 2023 at 12:23 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Wed, 1 Mar 2023 at 15:39, Alexander Potapenko <glider@xxxxxxxxxx> wrote:
> >
> > Add tests ensuring that memset16()/memset32()/memset64() are
> > instrumented by KMSAN and correctly initialize the memory.
> >
> > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
> > ---
> > mm/kmsan/kmsan_test.c | 22 ++++++++++++++++++++++
> > 1 file changed, 22 insertions(+)
> >
> > diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c
> > index cc98a3f4e0899..e450a000441fb 100644
> > --- a/mm/kmsan/kmsan_test.c
> > +++ b/mm/kmsan/kmsan_test.c
> > @@ -503,6 +503,25 @@ static void test_memcpy_aligned_to_unaligned2(struct kunit *test)
> > KUNIT_EXPECT_TRUE(test, report_matches(&expect));
> > }
> >
> > +/* Generate test cases for memset16(), memset32(), memset64(). */
> > +#define DEFINE_TEST_MEMSETXX(size, var_ty) \
> > + static void test_memset##size(struct kunit *test) \
> > + { \
> > + EXPECTATION_NO_REPORT(expect); \
> > + volatile var_ty uninit; \
>
> This could just be 'uint##size##_t' and you can drop 'var_ty'.
Indeed, thanks!