[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/22] vl: convert -tb-size to qemu_strtoul
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 04/22] vl: convert -tb-size to qemu_strtoul |
Date: |
Tue, 4 Jul 2017 11:33:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
On 03/07/2017 21:46, Richard Henderson wrote:
> On 07/03/2017 09:34 AM, Paolo Bonzini wrote:
>> -extern int tcg_tb_size;
>> +extern unsigned long tcg_tb_size;
>
> size_t would be more natural.
>
> I don't think we support any hosts for which sizeof(size_t) !=
> sizeof(unsigned long), but perhaps
There's Win64... Another place where to do the range check
could be tcg_exec_init. That's where the actual bug lies.
The previous code's error handling was even worse, since strtol's output
was completely unchecked. tcg_exec_init can be fixed later.
Paolo
> unsigned lomg tmp;
> if (qemu_strtoul(optarg, NULL, 0, &tmp) < 0
> || tmp != (size_t)tmp) {
> error_report("Invalid argument to -tb-size");
> exit(1);
> }
> tcg_tb_size = tmp;
>
> where I'd expect the extra comparison to be optimized away.
>
> But I'm not overly concerned either way, so
>
> Reviewed-by: Richard Henderson <address@hidden>
>
>
> r~
- Re: [Qemu-devel] [PATCH 03/22] configure: add --disable-tcg configure option, (continued)
- [Qemu-devel] [PATCH 01/22] configure: factor out list of supported Xen/KVM/HAX targets, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 05/22] vl: add tcg_enabled() for tcg related code, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 04/22] vl: convert -tb-size to qemu_strtoul, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 06/22] tcg: move page_size_init() function, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 08/22] tcg: make tcg_allowed global, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 07/22] tcg: tcg_handle_interrupt() function, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 10/22] vapic: use tcg_enabled, Paolo Bonzini, 2017/07/03
- [Qemu-devel] [PATCH 09/22] monitor: disable "info jit" and "info opcount" if !TCG, Paolo Bonzini, 2017/07/03