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


Groups > linux.kernel > #1533512 > unrolled thread

[bug report] perf jit: add source line info support

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-11-30 20:00 +0100
Last post2016-12-10 06:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [bug report] perf jit: add source line info support Dan Carpenter <dan.carpenter@oracle.com> - 2016-11-30 20:00 +0100
    Re: [bug report] perf jit: add source line info support Stephane Eranian <eranian@google.com> - 2016-12-10 06:20 +0100
      Re: [bug report] perf jit: add source line info support Stephane Eranian <eranian@google.com> - 2016-12-10 06:30 +0100

#1533512 — [bug report] perf jit: add source line info support

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-11-30 20:00 +0100
Subject[bug report] perf jit: add source line info support
Message-ID<sJigO-1kn-19@gated-at.bofh.it>
Hello Stephane Eranian,

The patch 598b7c6919c7: "perf jit: add source line info support" from
Nov 30, 2015, leads to the following static checker warning:

	./tools/perf/util/genelf_debug.c:211 emit_signed_LEB128()
	warn: potential left shift more than type allows '57'

./tools/perf/util/genelf_debug.c
   202  static void emit_signed_LEB128(struct buffer_ext *be, long data)
   203  {
   204          int more = 1;
   205          int negative = data < 0;
   206          int size = sizeof(long) * CHAR_BIT;
   207          while (more) {
   208                  ubyte cur = data & 0x7F;
   209                  data >>= 7;
   210                  if (negative)
   211                          data |= - (1 << (size - 7));
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a no-op on 64 bit systems.  I suspect it's not intentional?

   212                  if ((data == 0 && !(cur & 0x40)) ||
   213                      (data == -1l && (cur & 0x40)))
   214                          more = 0;
   215                  else
   216                          cur |= 0x80;
   217                  buffer_ext_add(be, &cur, 1);
   218          }
   219  }

regards,
dan carpenter

[toc] | [next] | [standalone]


#1539773

FromStephane Eranian <eranian@google.com>
Date2016-12-10 06:20 +0100
Message-ID<sMIeK-4rs-5@gated-at.bofh.it>
In reply to#1533512
Hi Dan,

On Wed, Nov 30, 2016 at 10:48 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> Hello Stephane Eranian,
>
> The patch 598b7c6919c7: "perf jit: add source line info support" from
> Nov 30, 2015, leads to the following static checker warning:
>
>         ./tools/perf/util/genelf_debug.c:211 emit_signed_LEB128()
>         warn: potential left shift more than type allows '57'
>
> ./tools/perf/util/genelf_debug.c
>    202  static void emit_signed_LEB128(struct buffer_ext *be, long data)
>    203  {
>    204          int more = 1;
>    205          int negative = data < 0;
>    206          int size = sizeof(long) * CHAR_BIT;
>    207          while (more) {
>    208                  ubyte cur = data & 0x7F;
>    209                  data >>= 7;
>    210                  if (negative)
>    211                          data |= - (1 << (size - 7));
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This is a no-op on 64 bit systems.  I suspect it's not intentional?
>
I suspect size should be: size = sizeof(int) * CHAR_BIT;
I will test that.

>    212                  if ((data == 0 && !(cur & 0x40)) ||
>    213                      (data == -1l && (cur & 0x40)))
>    214                          more = 0;
>    215                  else
>    216                          cur |= 0x80;
>    217                  buffer_ext_add(be, &cur, 1);
>    218          }
>    219  }
>
> regards,
> dan carpenter

[toc] | [prev] | [next] | [standalone]


#1539776

FromStephane Eranian <eranian@google.com>
Date2016-12-10 06:30 +0100
Message-ID<sMIoq-4xC-21@gated-at.bofh.it>
In reply to#1539773
On Fri, Dec 9, 2016 at 9:16 PM, Stephane Eranian <eranian@google.com> wrote:
> Hi Dan,
>
> On Wed, Nov 30, 2016 at 10:48 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
>> Hello Stephane Eranian,
>>
>> The patch 598b7c6919c7: "perf jit: add source line info support" from
>> Nov 30, 2015, leads to the following static checker warning:
>>
>>         ./tools/perf/util/genelf_debug.c:211 emit_signed_LEB128()
>>         warn: potential left shift more than type allows '57'
>>
>> ./tools/perf/util/genelf_debug.c
>>    202  static void emit_signed_LEB128(struct buffer_ext *be, long data)
>>    203  {
>>    204          int more = 1;
>>    205          int negative = data < 0;
>>    206          int size = sizeof(long) * CHAR_BIT;
>>    207          while (more) {
>>    208                  ubyte cur = data & 0x7F;
>>    209                  data >>= 7;
>>    210                  if (negative)
>>    211                          data |= - (1 << (size - 7));
>>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> This is a no-op on 64 bit systems.  I suspect it's not intentional?
>>
> I suspect size should be: size = sizeof(int) * CHAR_BIT;
> I will test that.
Sorry, I think the issue is on the 1 shift, should be 1UL instead.
>
>>    212                  if ((data == 0 && !(cur & 0x40)) ||
>>    213                      (data == -1l && (cur & 0x40)))
>>    214                          more = 0;
>>    215                  else
>>    216                          cur |= 0x80;
>>    217                  buffer_ext_add(be, &cur, 1);
>>    218          }
>>    219  }
>>
>> regards,
>> dan carpenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web