From: Kees Cook <kees@kernel.org>
To: Ivan Orlov <ivan.orlov0322@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Vitor Massaru Iha <vitor@massaru.org>,
Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <davidgow@google.com>, Rae Moar <rmoar@google.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-hardening@vger.kernel.org
Subject: Re: [PATCH 2/2] usercopy: Convert test_user_copy to KUnit test
Date: Mon, 10 Jun 2024 12:11:11 -0700 [thread overview]
Message-ID: <202406101209.1B76564DC@keescook> (raw)
In-Reply-To: <e384af13-ca63-4847-a84d-5957abd5d903@gmail.com>
On Wed, May 29, 2024 at 01:17:35PM +0100, Ivan Orlov wrote:
> On 5/19/24 20:12, Kees Cook wrote:
> > #define test(condition, msg, ...) \
> > ({ \
> > int cond = (condition); \
> > if (cond) \
> > - pr_warn("[%d] " msg "\n", __LINE__, ##__VA_ARGS__); \
> > + KUNIT_EXPECT_FALSE_MSG(test, cond, msg, ##__VA_ARGS__); \
> > cond; \
> > })
> It looks like the 'test' macro is not used anymore, so probably it should be
> removed.
Oops, yes. Thanks!
> > +static int usercopy_test_init(struct kunit *test)
> > +{
> > + struct usercopy_test_priv *priv;
> > + unsigned long user_addr;
> > - if (ret == 0) {
> > - pr_info("tests passed.\n");
> > - return 0;
> > - }
> > + priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
>
> Should the check be done with KUNIT_ASSERT_NOT_ERR_OR_NULL here as well, as
> it is done with priv->kmem?
Yes, that's much more idiomatic. I'll adjust this too.
> Other than that,
>
> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Thanks!
--
Kees Cook
next prev parent reply other threads:[~2024-06-10 19:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-19 19:12 [PATCH 0/2] usercopy: Convert test_user_copy to KUnit test Kees Cook
2024-05-19 19:12 ` [PATCH 1/2] kunit: test: Add vm_mmap() allocation resource manager Kees Cook
2024-05-20 9:29 ` Mark Rutland
2024-06-10 19:05 ` Kees Cook
2024-06-08 8:44 ` David Gow
2024-06-10 19:27 ` Kees Cook
2024-05-19 19:12 ` [PATCH 2/2] usercopy: Convert test_user_copy to KUnit test Kees Cook
2024-05-29 12:17 ` Ivan Orlov
2024-06-10 19:11 ` Kees Cook [this message]
2024-06-08 8:44 ` David Gow
2024-06-10 19:48 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202406101209.1B76564DC@keescook \
--to=kees@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=gustavoars@kernel.org \
--cc=ivan.orlov0322@gmail.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rmoar@google.com \
--cc=vitor@massaru.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox