[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 12 Dec 2014 13:21:09 +0000
From: Mark Brown <broonie@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Takashi Iwai <tiwai@...e.de>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: soc-dapm: Fix comparison of pointers
On Tue, Dec 09, 2014 at 10:53:41PM +0100, Rasmus Villemoes wrote:
> if (a->reg != b->reg)
> return a->reg - b->reg;
> - if (a->dapm != b->dapm)
> - return (unsigned long)a->dapm - (unsigned long)b->dapm;
> + if (a->dapm < b->dapm)
> + return -1;
> + if (a->dapm > b->dapm)
> + return 1;
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists