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


Groups > linux.kernel > #1734805 > unrolled thread

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

Started byMichael Ellerman <mpe@ellerman.id.au>
First post2017-09-19 12:40 +0200
Last post2017-09-21 13:10 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-09-19 12:40 +0200
SubjectRe: linux-4.14-rc1/arch/powerpc/perf/hv-24x7.c:541: bad condition ?
Message-ID<uro6B-4gb-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1736539

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-09-21 13:10 +0200
Message-ID<us7wK-cK-15@gated-at.bofh.it>
In reply to#1734805
[ + Cody in case he's still interested]

Michael Ellerman <mpe@ellerman.id.au> writes:
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web