* [PULL for-5.0 0/1] target/rx update for coverity warning @ 2020-04-08 15:30 Richard Henderson 2020-04-08 15:30 ` [PULL for-5.0 1/1] target/rx/translate: Add missing fall through comment Richard Henderson ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Richard Henderson @ 2020-04-08 15:30 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell The following changes since commit f3bac27cc1e303e1860cc55b9b6889ba39dee587: Update version for v5.0.0-rc2 release (2020-04-07 23:13:37 +0100) are available in the Git repository at: https://github.com/rth7680/qemu.git tags/pull-rx-20200408 for you to fetch changes up to 40bd0502dbee3ca1a9a481dd32dabe9230b8a37f: target/rx/translate: Add missing fall through comment (2020-04-07 18:45:54 -0700) ---------------------------------------------------------------- Add fall through comment for Coverity. ---------------------------------------------------------------- Philippe Mathieu-Daudé (1): target/rx/translate: Add missing fall through comment target/rx/translate.c | 1 + 1 file changed, 1 insertion(+) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL for-5.0 1/1] target/rx/translate: Add missing fall through comment 2020-04-08 15:30 [PULL for-5.0 0/1] target/rx update for coverity warning Richard Henderson @ 2020-04-08 15:30 ` Richard Henderson 2020-04-08 15:30 ` [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext Richard Henderson 2020-04-09 13:51 ` [PULL for-5.0 0/1] target/rx update for coverity warning Peter Maydell 2 siblings, 0 replies; 5+ messages in thread From: Richard Henderson @ 2020-04-08 15:30 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell, Philippe Mathieu-Daudé From: Philippe Mathieu-Daudé <philmd@redhat.com> Coverity reported a missing fall through comment, add it. Fixes: e5918d7d7f0 ("target/rx: TCG translation") Reported-by: Coverity (CID 1422222 MISSING_BREAK) Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200403184419.28556-1-philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- target/rx/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/rx/translate.c b/target/rx/translate.c index b3d7305f23..61e86653a4 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -2362,6 +2362,7 @@ static void rx_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) break; case DISAS_UPDATE: tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); + /* fall through */ case DISAS_EXIT: tcg_gen_exit_tb(NULL, 0); break; -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext 2020-04-08 15:30 [PULL for-5.0 0/1] target/rx update for coverity warning Richard Henderson 2020-04-08 15:30 ` [PULL for-5.0 1/1] target/rx/translate: Add missing fall through comment Richard Henderson @ 2020-04-08 15:30 ` Richard Henderson 2020-04-08 15:33 ` Richard Henderson 2020-04-09 13:51 ` [PULL for-5.0 0/1] target/rx update for coverity warning Peter Maydell 2 siblings, 1 reply; 5+ messages in thread From: Richard Henderson @ 2020-04-08 15:30 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell, Max Filippov From: Max Filippov <jcmvbkbc@gmail.com> Rather than dynamically allocate, and risk failing to free when we longjmp out of the translator, allocate the maximum buffer size from any of the supported cpus. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> [rth: Merged the fixup in Max's reply to his original] Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- target/xtensa/cpu.h | 3 +++ target/xtensa/helper.c | 1 + target/xtensa/translate.c | 18 ++---------------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index c0d69fad96..7a46dccbe1 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -213,6 +213,9 @@ enum { #define MEMCTL_IL0EN 0x1 #define MAX_INSN_LENGTH 64 +#define MAX_INSNBUF_LENGTH \ + ((MAX_INSN_LENGTH + sizeof(xtensa_insnbuf_word) - 1) / \ + sizeof(xtensa_insnbuf_word)) #define MAX_INSN_SLOTS 32 #define MAX_OPCODE_ARGS 16 #define MAX_NAREG 64 diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 376a61f339..7073381f03 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -96,6 +96,7 @@ static void init_libisa(XtensaConfig *config) config->isa = xtensa_isa_init(config->isa_internal, NULL, NULL); assert(xtensa_isa_maxlength(config->isa) <= MAX_INSN_LENGTH); + assert(xtensa_insnbuf_size(config->isa) <= MAX_INSNBUF_LENGTH); opcodes = xtensa_isa_num_opcodes(config->isa); formats = xtensa_isa_num_formats(config->isa); regfiles = xtensa_isa_num_regfiles(config->isa); diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 37f65b1f03..b898ee2261 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -72,8 +72,8 @@ struct DisasContext { unsigned cpenable; uint32_t op_flags; - xtensa_insnbuf insnbuf; - xtensa_insnbuf slotbuf; + xtensa_insnbuf_word insnbuf[MAX_INSNBUF_LENGTH]; + xtensa_insnbuf_word slotbuf[MAX_INSNBUF_LENGTH]; }; static TCGv_i32 cpu_pc; @@ -1173,16 +1173,6 @@ static void xtensa_tr_init_disas_context(DisasContextBase *dcbase, dc->cwoe = tb_flags & XTENSA_TBFLAG_CWOE; dc->callinc = ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> XTENSA_TBFLAG_CALLINC_SHIFT); - - /* - * FIXME: This will leak when a failed instruction load or similar - * event causes us to longjump out of the translation loop and - * hence not clean-up in xtensa_tr_tb_stop - */ - if (dc->config->isa) { - dc->insnbuf = xtensa_insnbuf_alloc(dc->config->isa); - dc->slotbuf = xtensa_insnbuf_alloc(dc->config->isa); - } init_sar_tracker(dc); } @@ -1272,10 +1262,6 @@ static void xtensa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) DisasContext *dc = container_of(dcbase, DisasContext, base); reset_sar_tracker(dc); - if (dc->config->isa) { - xtensa_insnbuf_free(dc->config->isa, dc->insnbuf); - xtensa_insnbuf_free(dc->config->isa, dc->slotbuf); - } if (dc->icount) { tcg_temp_free(dc->next_icount); } -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext 2020-04-08 15:30 ` [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext Richard Henderson @ 2020-04-08 15:33 ` Richard Henderson 0 siblings, 0 replies; 5+ messages in thread From: Richard Henderson @ 2020-04-08 15:33 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell, Max Filippov On 4/8/20 8:30 AM, Richard Henderson wrote: > From: Max Filippov <jcmvbkbc@gmail.com> > > Rather than dynamically allocate, and risk failing to free > when we longjmp out of the translator, allocate the maximum > buffer size from any of the supported cpus. > > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> > [rth: Merged the fixup in Max's reply to his original] > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- Oops. Leftover file in my to-mail directory. Not part of the rx pull, obviously. r~ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PULL for-5.0 0/1] target/rx update for coverity warning 2020-04-08 15:30 [PULL for-5.0 0/1] target/rx update for coverity warning Richard Henderson 2020-04-08 15:30 ` [PULL for-5.0 1/1] target/rx/translate: Add missing fall through comment Richard Henderson 2020-04-08 15:30 ` [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext Richard Henderson @ 2020-04-09 13:51 ` Peter Maydell 2 siblings, 0 replies; 5+ messages in thread From: Peter Maydell @ 2020-04-09 13:51 UTC (permalink / raw) To: Richard Henderson; +Cc: QEMU Developers On Wed, 8 Apr 2020 at 16:31, Richard Henderson <richard.henderson@linaro.org> wrote: > > The following changes since commit f3bac27cc1e303e1860cc55b9b6889ba39dee587: > > Update version for v5.0.0-rc2 release (2020-04-07 23:13:37 +0100) > > are available in the Git repository at: > > https://github.com/rth7680/qemu.git tags/pull-rx-20200408 > > for you to fetch changes up to 40bd0502dbee3ca1a9a481dd32dabe9230b8a37f: > > target/rx/translate: Add missing fall through comment (2020-04-07 18:45:54 -0700) > > ---------------------------------------------------------------- > Add fall through comment for Coverity. > > ---------------------------------------------------------------- Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0 for any user-visible changes. -- PMM ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-09 13:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-04-08 15:30 [PULL for-5.0 0/1] target/rx update for coverity warning Richard Henderson 2020-04-08 15:30 ` [PULL for-5.0 1/1] target/rx/translate: Add missing fall through comment Richard Henderson 2020-04-08 15:30 ` [PATCH for-5.0? v2] target/xtensa: Statically allocate xtensa_insnbufs in DisasContext Richard Henderson 2020-04-08 15:33 ` Richard Henderson 2020-04-09 13:51 ` [PULL for-5.0 0/1] target/rx update for coverity warning Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).