[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202404151733.59C3EF3@keescook>
Date: Mon, 15 Apr 2024 17:34:35 -0700
From: Kees Cook <keescook@...omium.org>
To: Jeff Xu <jeffxu@...omium.org>
Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>,
akpm@...ux-foundation.org, jannh@...gle.com, sroettger@...gle.com,
willy@...radead.org, gregkh@...uxfoundation.org,
torvalds@...ux-foundation.org, corbet@....net,
Liam.Howlett@...cle.com, surenb@...gle.com, merimus@...gle.com,
rdunlap@...radead.org, jeffxu@...gle.com, jorgelo@...omium.org,
groeck@...omium.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
pedro.falcato@...il.com, dave.hansen@...el.com,
linux-hardening@...r.kernel.org, deraadt@...nbsd.org
Subject: Re: [PATCH v10 3/5] selftest mm/mseal memory sealing
On Mon, Apr 15, 2024 at 01:27:32PM -0700, Jeff Xu wrote:
> On Mon, Apr 15, 2024 at 11:32 AM Muhammad Usama Anjum
> <usama.anjum@...labora.com> wrote:
> >
> > Please fix following for this and fifth patch as well:
> >
> > --> checkpatch.pl --codespell tools/testing/selftests/mm/mseal_test.c
> >
> > WARNING: Macros with flow control statements should be avoided
> > #42: FILE: tools/testing/selftests/mm/mseal_test.c:42:
> > +#define FAIL_TEST_IF_FALSE(c) do {\
> > + if (!(c)) {\
> > + ksft_test_result_fail("%s, line:%d\n", __func__,
> > __LINE__);\
> > + goto test_end;\
> > + } \
> > + } \
> > + while (0)
> >
> > WARNING: Macros with flow control statements should be avoided
> > #50: FILE: tools/testing/selftests/mm/mseal_test.c:50:
> > +#define SKIP_TEST_IF_FALSE(c) do {\
> > + if (!(c)) {\
> > + ksft_test_result_skip("%s, line:%d\n", __func__,
> > __LINE__);\
> > + goto test_end;\
> > + } \
> > + } \
> > + while (0)
> >
> > WARNING: Macros with flow control statements should be avoided
> > #59: FILE: tools/testing/selftests/mm/mseal_test.c:59:
> > +#define TEST_END_CHECK() {\
> > + ksft_test_result_pass("%s\n", __func__);\
> > + return;\
> > +test_end:\
> > + return;\
> > +}
> >
> I tried to fix those warnings of checkpatch in the past, but no good
> solution. If I put the condition check in the test, the code will have
> too many "if" and decrease readability. If there is a better
> solution, I'm happy to do that, suggestions are welcome.
Yeah, these are more "conventions" from checkpatch. I think it's fine to
ignore this warning, especially for selftests.
--
Kees Cook
Powered by blists - more mailing lists