[Skiboot] [PATCH] hw/ipmi/test/run-fru: Fix string truncation warning, enhance test
Stewart Smith
stewart at linux.ibm.com
Wed Mar 20 17:31:52 AEDT 2019
Stewart Smith <stewart at linux.ibm.com> writes:
> We've been getting this warning/error from recent GCC:
>
> In file included from hw/ipmi/test/run-fru.c:22:
> hw/ipmi/test/../ipmi-fru.c: In function ‘fru_add’:
> hw/ipmi/test/../ipmi-fru.c:162:3: warning: ‘strncpy’ output truncated copying 32 bytes from a string of length 38 [-Wstringop-truncation]
> strncpy(info.version, version, MAX_STR_LEN + 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This patch does two things:
> 1) Re-arrange some code to shut GCC up.
> 2) Add extra fu to tests to ensure we're producing correct bytes.
>
> Signed-off-by: Stewart Smith <stewart at linux.ibm.com>
> ---
> hw/ipmi/ipmi-fru.c | 16 +++++++++-------
> hw/ipmi/test/run-fru.c | 11 ++++++++++-
> 2 files changed, 19 insertions(+), 8 deletions(-)
Merged to master as of 043e85bf74774c9652c53c4d36dd7c7a3dffcd29
--
Stewart Smith
OPAL Architect, IBM.
More information about the Skiboot
mailing list