# \[PATCH 5.15 090/935\] dm raid1: reserve space for NUL-terminator in build\_constructor\_string()

- From: Greg Kroah-Hartman \<gregkh@linuxfoundation.org\>
- Date: 2026-09-12 17:07:04 
- List: stable
- Page: https://ratatoskr.run/stable/2026/09/17565601
- Thread: https://ratatoskr.run/stable/2026/09/17565548/t/2.md

```text
5.15-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilya Krutskih <redacted>

commit 73c37fe54cd056d07461b142ab0b8b81e1ef6ad8 upstream.

Reserve space for the termination NUL after the maximum 20 decimal
digits of a long long value to avoid buffer overflow in sprintf().

Fixes: f5db4af466e2 ("dm raid1: add userspace log")
Cc: <redacted>
Signed-off-by: Ilya Krutskih <redacted>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-log-userspace-base.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -138,6 +138,7 @@ static int build_constructor_string(stru
 		str_size += strlen(argv[i]) + 1; /* +1 for space between args */
 
 	str_size += 20; /* Max number of chars in a printed u64 number */
+	str_size++; /* For NUL-terminator */
 
 	str = kzalloc(str_size, GFP_KERNEL);
 	if (!str) {


```
