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:	Thu, 25 Apr 2013 10:15:44 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Linus WALLEIJ <linus.walleij@...ricsson.com>,
	Vinod Koul <vinod.koul@...el.com>, Dan Williams <djbw@...com>,
	Per Forlin <per.forlin@...ricsson.com>,
	Rabin Vincent <rabin@....in>
Subject: Re: [PATCH 08/32] dmaengine: ste_dma40: Optimise local MAX() macro

On Thu, 25 Apr 2013, Linus Walleij wrote:

> On Thu, Apr 18, 2013 at 12:11 PM, Lee Jones <lee.jones@...aro.org> wrote:
> 
> > The current implementation of the DMA40's local MAX() macro evaluates
> > its arguments more times than is necessary. This patch strips it
> > optimises it to only evaluate what's appropriate.
> >
> > Cc: Vinod Koul <vinod.koul@...el.com>
> > Cc: Dan Williams <djbw@...com>
> > Cc: Per Forlin <per.forlin@...ricsson.com>
> > Cc: Rabin Vincent <rabin@....in>
> > Reported-by: Harvey Harrison <harvey.harrison@...il.com>
> > Signed-off-by: Lee Jones <lee.jones@...aro.org>
> (...)
> > -#define MAX(a, b) (((a) < (b)) ? (b) : (a))
> > +#define MAX(a, b) ((a > b) ? a : b)
> 
> Much has been said about this patch already, but notice what it is
> used for instead, one single thing at compile-time:
> 
> struct d40_base {
> (...)
>         u32
> reg_val_backup_v4[MAX(BACKUP_REGS_SZ_V4A, BACKUP_REGS_SZ_V4B)];
> (...)
> };
> 
> i.e. defining the size of that array at compile-time.
> 
> The actual size is figured out in d40_hw_detect_init().
> 
> So what about you just devm_kmalloc() that array instead and
> delete this macro. That is the real fix.

I'm happy to do it, but please see v2 of this patch first.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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