diff mbox series

acpi: crsdump: Fix printing of IRQ numbers

Message ID 20260507080851.2937050-1-thuth@redhat.com
State Accepted
Headers show
Series acpi: crsdump: Fix printing of IRQ numbers | expand

Commit Message

Thomas Huth May 7, 2026, 8:08 a.m. UTC
From: Thomas Huth <thuth@redhat.com>

Clang complains when compiling this file:

 acpi/crsdump/crsdump.c:328:30: error: size argument in 'strlcat' call
  appears to be size of the source; expected the size of the destination
       [-Werror,-Wstrlcpy-strlcat-size]
   328 |                                 strlcat(buf, tmp, sizeof(tmp));
       |                                                   ~~~~~~~^~~~
 acpi/crsdump/crsdump.c:328:23: note: change size argument to be the size
  of the destination
   328 |                                 strlcat(buf, tmp, sizeof(tmp));
       |                                                   ^~~~~~~~~~~
       |                                                   sizeof(buf)

And indeed, this function currently fails to print any IRQ numbers.
Use the size of the destination buffer instead to fix the problem.

Fixes: 3f151922 ("Fix some strncpy/strcat gcc 8.2 warnings by using libbsd strlcpy/strlcat")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 src/acpi/crsdump/crsdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
index 7730960b..e798e5b0 100644
--- a/src/acpi/crsdump/crsdump.c
+++ b/src/acpi/crsdump/crsdump.c
@@ -325,7 +325,7 @@  static const char *crs_irq_map(const uint64_t val)
 				char tmp[5];
 
 				snprintf(tmp, sizeof(tmp), " %u", i);
-				strlcat(buf, tmp, sizeof(tmp));
+				strlcat(buf, tmp, sizeof(buf));
 			}
 		}
 	}