lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGS_qxoXJ1BgvRLY9F=DxHfUntRvkVBHqgJMc=0E+qCGVj6bdw@mail.gmail.com>
Date:   Fri, 2 Jun 2023 14:09:31 -0700
From:   Daniel Latypov <dlatypov@...gle.com>
To:     Maxime Ripard <mripard@...nel.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        David Gow <davidgow@...gle.com>,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-kernel@...r.kernel.org, Maxime Ripard <maxime@...no.tech>
Subject: Re: [PATCH RESEND 1/2] drivers: base: Add basic devm tests for root devices

On Fri, Jun 2, 2023 at 8:20 AM Maxime Ripard <mripard@...nel.org> wrote:

One small suggestion below
<snip>

> +static void root_device_devm_register_unregister_test(struct kunit *test)
> +{
> +       struct test_priv *priv;
> +       int ret;
> +
> +       priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
> +       init_waitqueue_head(&priv->release_wq);


Note: should we use an init function to handle this setup?
We can store it in test->priv instead.

static int my_init(struct kunit *test)
{
  struct test_priv *priv;

  priv = kunit_kzalloc(test, sizeof(test_priv), GFP_KERNEL);
  if (!priv) return -ENOMEM;
  // N.B. I think you could probably still use assert instead

  init_waitqueue_head(&priv->release_wq);

  priv->dev = root_device_register(DEVICE_NAME);
  if (!priv->dev) return -ENOMEM;

  test->priv = priv;
}

...
static struct kunit_suite root_device_devm_test_suite = {
       .name = "root-device-devm",
       .init = my_init,
       .test_cases = root_device_devm_tests,
};

Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ