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]
Date:   Thu, 25 May 2023 08:05:58 +0300
From:   Dan Carpenter <dan.carpenter@...aro.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Wang Zhang <silver_code@...t.edu.cn>,
        Peter Korsgaard <peter@...sgaard.com>,
        Andrew Lunn <andrew@...n.ch>,
        hust-os-kernel-patches@...glegroups.com, linux-i2c@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] i2c: ocores: use devm_ managed clks

On Wed, May 24, 2023 at 09:21:56PM +0200, Christophe JAILLET wrote:
> > +	if (ret) {
> > +		dev_err(dev,
> > +			"clk_prepare_enable failed: %d\n", ret);
> > +		return ret;
> >   	}
> > +	rate = clk_get_rate(i2c->clk) / 1000;
> 
> Now (because of the devm_clk_get_optional_enabled()), i2c->clk can be NULL,
> so this would deference a NULL pointer.
> 

No, it's fine.  clk_get_rate() checks for NULL.  When a function returns
a mix of error pointers and NULL, like devm_clk_get_optional_enabled(),
then all the functions like this must have NULL checks built it.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ