mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: soc-dapm: Fix comparison of pointers
Date: Fri, 12 Dec 2014 13:21:09 +0000	[thread overview]
Message-ID: <20141212132109.GH11764@sirena.org.uk> (raw)
In-Reply-To: <1418162021-32229-1-git-send-email-linux@rasmusvillemoes.dk>

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-12-12 13:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 21:53 Rasmus Villemoes
2014-12-12 13:21 ` Mark Brown [this message]
2014-12-12 13:43   ` Rasmus Villemoes
2014-12-12 14:17     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141212132109.GH11764@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®