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]
Message-ID: <20231114124832.40d4ced4@bootlin.com>
Date:   Tue, 14 Nov 2023 12:48:32 +0100
From:   Herve Codina <herve.codina@...tlin.com>
To:     Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     Saravana Kannan <saravanak@...gle.com>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        linux-kernel@...r.kernel.org,
        Allan Nielsen <allan.nielsen@...rochip.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>,
        Steen Hegelund <steen.hegelund@...rochip.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        stable@...r.kernel.org
Subject: Re: [PATCH 1/1] lib/vsprintf: Fix %pfwf when current node refcount
 == 0

Hi Sakari,

On Tue, 14 Nov 2023 11:28:43 +0000
Sakari Ailus <sakari.ailus@...ux.intel.com> wrote:

> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -2108,8 +2108,8 @@ char *fwnode_full_name_string(struct fwnode_handle *fwnode, char *buf,
> >  {
> >  	int depth;
> >  
> > -	/* Loop starting from the root node to the current node. */
> > -	for (depth = fwnode_count_parents(fwnode); depth >= 0; depth--) {
> > +	/* Loop starting from the root node to the parent of current node. */
> > +	for (depth = fwnode_count_parents(fwnode); depth > 0; depth--) {
> >  		struct fwnode_handle *__fwnode =
> >  			fwnode_get_nth_parent(fwnode, depth);  
> 
> How about, without changing the loop:
> 
> 		/*
> 		 * Only get a reference for other nodes, fwnode refcount
> 		 * may be 0 here.
> 		 */
> 		struct fwnode_handle *__fwnode =
> 			depth ? fwnode_get_nth_parent(fwnode, depth) : fwnode;
> 
> >  
> > @@ -2121,6 +2121,16 @@ char *fwnode_full_name_string(struct fwnode_handle *fwnode, char *buf,
> >  		fwnode_handle_put(__fwnode);  
> 
> And:
> 
> 		if (__fwnode != fwnode)
> 			fwnode_handle_put(__fwnode);
> 

Sure.
I will just change to keep the both tests consistent.
I mean test with depth or test with __fwnode != fwnode but avoid
mixing them.

What do you think about testing using depth in all cases and so:
	if (depth)
		fwnode_handle_put(__fwnode);

Best regards,
Hervé

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ