From a5b5e784e12158cbf37b19044f778b910b236572 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Fri, 16 May 2025 13:24:56 -0400 Subject: [PATCH] wdc: fix muon build warning Change the string length to 41 from 40 for the warning below. [165/166] linking unit/test-uint128 ../plugins/wdc/wdc-nvme.c: In function 'wdc_print_unsupported_reqs_log_json': ../plugins/wdc/wdc-nvme.c:5381:71: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=] sprintf((char *)unsup_req_list_str, "Unsupported Requirement List %d", j); ^ ../plugins/wdc/wdc-nvme.c:5381:3: note: 'sprintf' output between 31 and 41 bytes into a destination of size 40 sprintf((char *)unsup_req_list_str, "Unsupported Requirement List %d", j); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Tokunori Ikegami --- plugins/wdc/wdc-nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 3d03aeb094..48c0442ed7 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -5374,9 +5374,9 @@ static void wdc_print_unsupported_reqs_log_json(struct wdc_ocp_C5_unsupported_re json_object_add_value_int(root, "Number Unsupported Req IDs", le16_to_cpu(log_data->unsupported_count)); - char unsup_req_list_str[40]; + char unsup_req_list_str[41]; - memset((void *)unsup_req_list_str, 0, 40); + memset((void *)unsup_req_list_str, 0, 41); for (j = 0; j < le16_to_cpu(log_data->unsupported_count); j++) { sprintf((char *)unsup_req_list_str, "Unsupported Requirement List %d", j); json_object_add_value_string(root, unsup_req_list_str, (char *)log_data->unsupported_req_list[j]);