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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 15 Apr 2024 14:31:21 +0100
From: Richard Fitzgerald <rf@...nsource.cirrus.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Mark Brown <broonie@...nel.org>,
        Greg Kroah-Hartman
	<gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] regmap: kunit: Fix an NULL vs IS_ERR() check

On 15/04/2024 11:34, Dan Carpenter wrote:
> The kunit_device_register() function returns error pointers, not NULL.
> Passing an error pointer to get_device() will lead to an Oops.  Also
> get_device() returns the same device you passed to it.  Fix it!  ;)
> 
> Fixes: 7b7982f14315 ("regmap: kunit: Create a struct device for the regmap")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>   drivers/base/regmap/regmap-kunit.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
> index 44265dc2313d..9c5314785fc2 100644
> --- a/drivers/base/regmap/regmap-kunit.c
> +++ b/drivers/base/regmap/regmap-kunit.c
> @@ -1925,10 +1925,10 @@ static int regmap_test_init(struct kunit *test)
>   	test->priv = priv;
>   
>   	dev = kunit_device_register(test, "regmap_test");
> -	priv->dev = get_device(dev);
> -	if (!priv->dev)
> -		return -ENODEV;
> +	if (IS_ERR(dev))
> +		return PTR_ERR(dev);
>   
> +	priv->dev = get_device(dev);
>   	dev_set_drvdata(dev, test);
>   
>   	return 0;

Reviewed-by: Richard Fitzgerald <rf@...nsource.cirrus.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ