Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734805

Re: linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:541: bad condition ?

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:541: bad condition ?
Date 2017-09-19 12:40 +0200
Message-ID <uro6B-4gb-9@gated-at.bofh.it> (permalink)
References <uro6B-4gb-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


David Binderman <dcb314@hotmail.com> writes:

> Hello there,
>
> linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:543]: (warning) Identical condition 's1<s2', second condition is always false
>
> Source code is
>
>     if (s1 < s2)
>         return 1;
>     if (s2 > s1)
>         return -1;
>
> Suggest code rework.

Um thanks.

It's trying to implement a sort comparison returning -1, 0, 1.

So it's pretty obviously wrong, but also harmless AFAICS, because it's
just an optimisation before doing a full comparison using memcmp().

So yeah we should fix it, but not an actual bug AFAICS.

cheers

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:541: bad condition ? Michael Ellerman <mpe@ellerman.id.au> - 2017-09-19 12:40 +0200
  Re: linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:541: bad condition ? Michael Ellerman <mpe@ellerman.id.au> - 2017-09-21 13:10 +0200

csiph-web