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] [day] [month] [year] [list]
Date:	Fri, 28 Nov 2014 11:49:30 +0200
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	"H . Peter Anvin" <hpa@...ux.intel.com>, x86@...nel.org,
	Aubrey Li <aubrey.li@...ux.intel.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	"Kumar P, Mahesh" <mahesh.kumar.p@...el.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/3] x86: pmc_atom: don't check for NULL twice

On Wed, 2014-11-19 at 12:36 +0100, Thomas Gleixner wrote:
> On Wed, 12 Nov 2014, Andy Shevchenko wrote:
> 
> > debugfs_remove_recursive() is NULL-aware, thus, we may safely remove the check
> > here. There is no need to assing NULL to variable since it will be not used
> > anywhere.

Thanks for review, my comments below.

> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Acked-by: Aubrey Li <aubrey.li@...ux.intel.com>
> > ---
> >  arch/x86/kernel/pmc_atom.c | 4 ----
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c
> > index 19b8efa..bcc91ea 100644
> > --- a/arch/x86/kernel/pmc_atom.c
> > +++ b/arch/x86/kernel/pmc_atom.c
> > @@ -202,11 +202,7 @@ static const struct file_operations pmc_sleep_tmr_ops = {
> >  
> >  static void pmc_dbgfs_unregister(struct pmc_dev *pmc)
> >  {
> > -	if (!pmc->dbgfs_dir)
> > -		return;
> > -
> >  	debugfs_remove_recursive(pmc->dbgfs_dir);
> > -	pmc->dbgfs_dir = NULL;
> >  }
> 
> So while the patch is correct per se, the whole function is useless.
> 
> pmc_dbgfs_register()
> 
> 	dir = debugfs_create_dir("pmc_atom", NULL);
> 
> 	....
> 	if (!f)
> 		goto err;
> 
> 	pmc->dbgfs_dir = dir;
> 	return 0;
> err:
> 	pmc_dbgfs_unregister(pmc);
> 
> So pmc->dbgfs_dir is always NULL when this is called....

Good catch, I add a new patch to address this.


> Aside of that, if DEBUGFS=n the code keeps pmc->regmap ioremapped for
> no reason.

pmc_hw_reg_setup() uses it. Aubrey, is it intended behaviour?

> Looking deeper:
> 
> The pmc_power_off function is installed _BEFORE_ pmc_hw_reg_setup() is
> called, which might not be called if the ioremap fails ....

I don't see any problem here (pmc_power_off uses acpi_base_addr which is
independent to IO mapped space), though Aubrey may shed a light on this.

-- 
Andy Shevchenko <andriy.shevchenko@...el.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ