[PATCH 0/2] tests/qtest: Avoid char arrays in some Arm tests

Peter Maydell posted 2 patches 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260310151507.2973843-1-peter.maydell@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
tests/qtest/arm-cpu-features.c   | 24 +++++++++++++++---------
tests/qtest/ast2700-sgpio-test.c | 24 ++++++++++++------------
2 files changed, 27 insertions(+), 21 deletions(-)
[PATCH 0/2] tests/qtest: Avoid char arrays in some Arm tests
Posted by Peter Maydell 4 weeks ago
This patchset fixes a couple of problems reported by Fabiano Rosas
with gcc 7.5.0 now we have turned on -Wformat-overflow=2. In both
cases the test is using sprintf() into a fixed-size char array, and
it can't actually overflow but gcc doesn't realize that. We prefer
to use g_strdup_printf() for this kind of thing anyway, as it is
much less error-prone, so switch to that.

thanks
-- PMM

Peter Maydell (2):
  tests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char
    arrays
  tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char
    arrays

 tests/qtest/arm-cpu-features.c   | 24 +++++++++++++++---------
 tests/qtest/ast2700-sgpio-test.c | 24 ++++++++++++------------
 2 files changed, 27 insertions(+), 21 deletions(-)

-- 
2.43.0
Re: [PATCH 0/2] tests/qtest: Avoid char arrays in some Arm tests
Posted by Cédric Le Goater 4 weeks ago
On 3/10/26 16:15, Peter Maydell wrote:
> This patchset fixes a couple of problems reported by Fabiano Rosas
> with gcc 7.5.0 now we have turned on -Wformat-overflow=2. In both
> cases the test is using sprintf() into a fixed-size char array, and
> it can't actually overflow but gcc doesn't realize that. We prefer
> to use g_strdup_printf() for this kind of thing anyway, as it is
> much less error-prone, so switch to that.
> 
> thanks
> -- PMM
> 
> Peter Maydell (2):
>    tests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char
>      arrays
>    tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char
>      arrays
> 
>   tests/qtest/arm-cpu-features.c   | 24 +++++++++++++++---------
>   tests/qtest/ast2700-sgpio-test.c | 24 ++++++++++++------------
>   2 files changed, 27 insertions(+), 21 deletions(-)
> 

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


Re: [PATCH 0/2] tests/qtest: Avoid char arrays in some Arm tests
Posted by Fabiano Rosas 4 weeks ago
Peter Maydell <peter.maydell@linaro.org> writes:

> This patchset fixes a couple of problems reported by Fabiano Rosas
> with gcc 7.5.0 now we have turned on -Wformat-overflow=2. In both
> cases the test is using sprintf() into a fixed-size char array, and
> it can't actually overflow but gcc doesn't realize that. We prefer
> to use g_strdup_printf() for this kind of thing anyway, as it is
> much less error-prone, so switch to that.
>
> thanks
> -- PMM
>
> Peter Maydell (2):
>   tests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char
>     arrays
>   tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char
>     arrays
>
>  tests/qtest/arm-cpu-features.c   | 24 +++++++++++++++---------
>  tests/qtest/ast2700-sgpio-test.c | 24 ++++++++++++------------
>  2 files changed, 27 insertions(+), 21 deletions(-)

Series:

Tested-by: Fabiano Rosas <farosas@suse.de>