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: <20110413114808.12783565.akpm@linux-foundation.org>
Date:	Wed, 13 Apr 2011 11:48:08 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Alexey Dobriyan <adobriyan@...il.com>,
	linux-kernel@...r.kernel.org, behlendorf1@...l.gov
Subject: Re: [PATCH] remove abs64()

On Wed, 13 Apr 2011 16:27:03 +0200
Oleg Nesterov <oleg@...hat.com> wrote:

> On 04/13, Alexey Dobriyan wrote:
> >
> > +#define abs(x)								\
> > +({									\
> > +	typeof(x) _x = (x);						\
> > +									\
> > +	__builtin_choose_expr(						\
> > +		__builtin_types_compatible_p(typeof(_x), signed char),	\
> > +		(unsigned char)({ _x < 0 ? -_x : _x; }),		\
> > +	__builtin_choose_expr(						\
> > +		__builtin_types_compatible_p(typeof(_x), short),	\
> > +		(unsigned short)({ _x < 0 ? -_x : _x; }),		\
> > +	__builtin_choose_expr(						\
> > +		__builtin_types_compatible_p(typeof(_x), int),		\
> > +		(unsigned int)({ _x < 0 ? -_x : _x; }),			\
> > +	__builtin_choose_expr(						\
> > +		__builtin_types_compatible_p(typeof(_x), long),		\
> > +		(unsigned long)({ _x < 0 ? -_x : _x; }),		\
> > +	__builtin_choose_expr(						\
> > +		__builtin_types_compatible_p(typeof(_x), long long),	\
> > +		(unsigned long long)({ _x < 0 ? -_x : _x; }),		\
> > +	_x)))));							\
> > +})
> 
> Personally I agree.
> 
> But, we have some stupid users which do something like abs(u32_value)
> and expecting that abs() should treat this value as "signed".
> 

um, yes, I'd forgotten that one.  That's a show-stopper.
--
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