[alsa-devel] [PATCH] ASoC: soc-dapm: Fix comparison of pointers

Mark Brown broonie at kernel.org
Fri Dec 12 15:17:14 CET 2014


On Fri, Dec 12, 2014 at 02:43:27PM +0100, Rasmus Villemoes wrote:
> On Fri, Dec 12 2014, Mark Brown <broonie at kernel.org> wrote:

> > If we're worrying about standards conformance type stuff here this is
> > also buggy since it's out of spec to compare pointers that are not part
> > of the same array like this.  Casting to uintptr_t is a better fix here.

> I'm not worrying about standards conformance. Casting pointers to and
> from [unsigned] long is done everywhere in the kernel, and that's
> fine. But subtracting ints or longs and using the sign of the result for
> comparison is simply wrong. See acbbe6fbb2 (kcmp: fix standard
> comparison bug) for the long story. In this case the narrowing (when
> BITS_PER_LONG==64) of the result from long to int just makes it even
> more wrong.

*sigh*  If that's what you meant you should've said so in your commit
log since that's distinctly non-obvious.  In any case, regardless of why
you originally wanted to do this the fact remains that your new version
is out of spec.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141212/26a0195b/attachment.sig>


More information about the Alsa-devel mailing list