qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 139/147] meson: replace create-config with meson configure_fi


From: Paolo Bonzini
Subject: Re: [PATCH 139/147] meson: replace create-config with meson configure_file
Date: Tue, 11 Aug 2020 19:16:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 11/08/20 19:12, Alexander Bulekov wrote:
> On 200811 1825, Philippe Mathieu-Daudé wrote:
>> On 8/11/20 6:20 PM, Philippe Mathieu-Daudé wrote:
>>> On 8/10/20 7:08 PM, Paolo Bonzini wrote:
>>>> Move the create-config logic to meson.build; create a
>>>> configuration_data object and let meson handle the
>>>> quoting and output.
>>>>
>>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>>> ---
>>>>  Makefile                       |   2 +-
>>>>  block.c                        |   4 +-
>>>>  configure                      |   9 ++-
>>>>  meson.build                    | 100 ++++++++++++++++++++++---------
>>>>  scripts/create_config          | 131 
>>>> -----------------------------------------
>>>>  tests/qtest/bios-tables-test.c |   2 +-
>>>>  6 files changed, 80 insertions(+), 168 deletions(-)
>>>>  delete mode 100755 scripts/create_config
>>>>
>>>> diff --git a/Makefile b/Makefile
>>>> index cd4eeb5..1eec727 100644
>>>> --- a/Makefile
>>>> +++ b/Makefile
>>>> @@ -189,7 +189,7 @@ clean: recurse-clean
>>>>    rm -f fsdev/*.pod scsi/*.pod
>>>>    rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
>>>>  
>>>> -VERSION ?= $(shell cat VERSION)
>>>> +VERSION = $(shell cat $(SRC_PATH)/VERSION)
>>>>  
>>>>  dist: qemu-$(VERSION).tar.bz2
>>>>  
>>>> diff --git a/block.c b/block.c
>>>> index 67c5028..67ca543 100644
>>>> --- a/block.c
>>>> +++ b/block.c
>>>> @@ -443,13 +443,13 @@ static int bdrv_format_is_whitelisted(const char 
>>>> *format_name, bool read_only)
>>>>          return 1;               /* no whitelist, anything goes */
>>>>      }
>>>>  
>>>> -    for (p = whitelist_rw; *p; p++) {
>>>> +    for (p = whitelist_rw; p < &whitelist_rw[ARRAY_SIZE(whitelist_rw)]; 
>>>> p++) {
>>>
>>> Alexander reported [*] a problem when ARRAY_SIZE(whitelist_rw) == 0 you
>>> access an undefined address:
>>
>> The question is why CONFIG_BDRV_RW_WHITELIST & CONFIG_BDRV_RO_WHITELIST
>> aren't generated by meson.build...
> 
> Something like this?
> 
> diff --git a/meson.build b/meson.build
> index 300256bf70..d06fa56190 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -378,6 +378,8 @@ foreach k, v: config_host
>    if arrays.contains(k)
>      if v != ''
>        v = '"' + '", "'.join(v.split()) + '", '
> +    else
> +      v = 'NULL'
>      endif
>      config_host_data.set(k, v)
>    elif k == 'ARCH'

This doesn't work, because then you dereference a NULL on the first
iteration.  I'll revert back to without the ARRAY_SIZE.

Paolo

>>
>>>
>>> block.c:442:10: runtime error: index 0 out of bounds for type 'const
>>> char *[0]'
>>>
>>> [*] https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg02066.html
>>>
>>>>          if (!strcmp(format_name, *p)) {
>>>>              return 1;
>>>>          }
>>>>      }
>>>>      if (read_only) {
>>>> -        for (p = whitelist_ro; *p; p++) {
>>>> +        for (p = whitelist_ro; p < 
>>>> &whitelist_ro[ARRAY_SIZE(whitelist_ro)]; p++) {
>>>
>>> Ditto.
>>>
>>>>              if (!strcmp(format_name, *p)) {
>>>>                  return 1;
>>>>              }
>>> [...]
>>>
>>
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]