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: <1432308615.1428.10.camel@misato.fc.hp.com>
Date:	Fri, 22 May 2015 09:30:15 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	hpa@...or.com, mingo@...hat.com, akpm@...ux-foundation.org,
	arnd@...db.de, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	x86@...nel.org, linux-nvdimm@...1.01.org, jgross@...e.com,
	stefan.bader@...onical.com, luto@...capital.net, hmh@....eng.br,
	yigal@...xistor.com, konrad.wilk@...cle.com, Elliott@...com,
	mcgrof@...e.com, hch@....de
Subject: Re: [PATCH v9 8/10] x86, mm: Add set_memory_wt() for WT

On Fri, 2015-05-22 at 09:48 +0200, Thomas Gleixner wrote:
> On Wed, 13 May 2015, Toshi Kani wrote:
> > +int set_memory_wt(unsigned long addr, int numpages)
> > +{
> > +	int ret;
> > +
> > +	if (!pat_enabled)
> > +		return set_memory_uc(addr, numpages);
> > +
> > +	ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
> > +			      _PAGE_CACHE_MODE_WT, NULL);
> > +	if (ret)
> > +		goto out_err;
> > +
> > +	ret = _set_memory_wt(addr, numpages);
> > +	if (ret)
> > +		goto out_free;
> > +
> > +	return 0;
> > +
> > +out_free:
> > +	free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
> > +out_err:
> > +	return ret;
> 
> 
> This goto zoo is horrible to read. What's wrong with a straight forward:
> 
> +	if (!pat_enabled)
> +		return set_memory_uc(addr, numpages);
> +
> +	ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
> +			      _PAGE_CACHE_MODE_WT, NULL);
> +	if (ret)
> +		return ret;
> +
> +	ret = _set_memory_wt(addr, numpages);
> +	if (ret)
> +		free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
> +	return ret;

Agreed.  I will change set_memory_wc() as well, which is the base of
this function. 

Thanks,
-Toshi


--
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