Skip to content
Snippets Groups Projects
  1. Nov 24, 2023
    • Philippe Mathieu-Daudé's avatar
      disas/cris: Pass buffer size to format_dec() to avoid overflow warning · 2037a739
      Philippe Mathieu-Daudé authored
      
      Propagate the buffer size to format_dec() and use snprintf().
      
      This should silence this UBSan -Wformat-overflow warning:
      
        In file included from /usr/include/stdio.h:906,
                         from include/qemu/osdep.h:114,
                         from ../disas/cris.c:21:
        In function 'sprintf',
            inlined from 'format_dec' at ../disas/cris.c:1737:3,
            inlined from 'print_with_operands' at ../disas/cris.c:2477:12,
            inlined from 'print_insn_cris_generic.constprop' at ../disas/cris.c:2690:8:
        /usr/include/bits/stdio2.h:30:10: warning: null destination pointer [-Wformat-overflow=]
         30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         31 |                                   __glibc_objsize (__s), __fmt,
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         32 |                                   __va_arg_pack ());
            |                                   ~~~~~~~~~~~~~~~~~
      
      Reported-by: default avatarAkihiko Odaki <akihiko.odaki@daynix.com>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-ID: <20231120132222.82138-1-philmd@linaro.org>
      [Rewritten to fix logic and avoid repeated expression. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2037a739
  2. Nov 17, 2023
  3. Nov 07, 2023
  4. Oct 12, 2023
  5. Sep 29, 2023
  6. Jul 19, 2023
    • Christoph Müllner's avatar
      riscv/disas: Fix disas output of upper immediates · 36df75a0
      Christoph Müllner authored
      
      The GNU assembler produces the following output for instructions
      with upper immediates:
          00002597                auipc   a1,0x2
          000024b7                lui     s1,0x2
          6409                    lui     s0,0x2 # c.lui
      
      The immediate operands of upper immediates are not shifted.
      
      However, the QEMU disassembler prints them shifted:
          00002597          auipc                   a1,8192
          000024b7          lui                     s1,8192
          6409              lui                     s0,8192 # c.lui
      
      The current implementation extracts the immediate bits and shifts the by 12,
      so the internal representation of the immediate is the actual immediate.
      However, the immediates are later printed using rv_fmt_rd_imm or
      rv_fmt_rd_offset, which don't undo the shift.
      
      Let's fix this by using specific output formats for instructions
      with upper immediates, that take care of the shift.
      
      Signed-off-by: default avatarChristoph Müllner <christoph.muellner@vrull.eu>
      Acked-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Message-Id: <20230711075051.1531007-1-christoph.muellner@vrull.eu>
      Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      36df75a0
  7. Jul 10, 2023
  8. Jun 20, 2023
  9. Jun 13, 2023
  10. May 25, 2023
  11. May 11, 2023
  12. May 05, 2023
  13. Mar 14, 2023
  14. Mar 05, 2023
  15. Feb 06, 2023
  16. Jan 13, 2023
  17. Nov 08, 2022
Loading