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, 18 Apr 2013 13:19:49 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	"Russell King - ARM Linux" <linux@....linux.org.uk>
Cc:	Lee Jones <lee.jones@...aro.org>, Rabin Vincent <rabin@....in>,
	linus.walleij@...ricsson.com, Vinod Koul <vinod.koul@...el.com>,
	linux-kernel@...r.kernel.org,
	Per Forlin <per.forlin@...ricsson.com>,
	Dan Williams <djbw@...com>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 08/32] dmaengine: ste_dma40: Optimise local MAX() macro

On Thursday 18 April 2013, Russell King - ARM Linux wrote:
> Never got the original patch...
> 
> A much better idea is to get rid of that buggy MAX() macro altogether
> and use the macros already provided by the kernel, which are safe from
> side effects - but more importantly are type _safe_.  The above goes
> wrong when you consider 'a' and 'b' may have different signed-ness.

Yes, that's what was suggested before.

> Consider:
> 
>         int val_in = -5;
>         unsigned val = MAX(val_in, 5U);
> 
> The resulting value is (unsigned)-5, not (unsigned)5.
> 
> Best use the kernel's max() or max_t() _everywhere_.

Unfortunately, the (only) use of this macro is in a structure declaration
where you cannot use the syntax of max():

struct d40_base {
	...
        u32    reg_val_backup_v4[MAX(BACKUP_REGS_SZ_V4A, BACKUP_REGS_SZ_V4B)];
	...
};

My preferred solution would be to remove the MAX macro here and
define a new constant

#define BACKUP_REGS_SZ ((BACKUP_REGS_SZ_V4A > BACKUP_REGS_SZ_V4B) ? \
			 BACKUP_REGS_SZ_V4A : BACKUP_REGS_SZ_V4B)

But I don't see it as much of an improvement over what is currently
there.

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