| 1 | From 0483993a64f6d922d71dddd8f7f353d8bc22d1bf Mon Sep 17 00:00:00 2001
|
| 2 | From: Evgeni Golov <[email protected]>
|
| 3 | Date: Sat, 29 Aug 2026 19:30:32 +0200
|
| 4 | Subject: [PATCH] use strscpy instead of strncpy
|
| 5 |
|
| 6 | strncpy was removed in Linux 7.2
|
| 7 |
|
| 8 | Source: https://patch-diff.githubusercontent.com/raw/linux-thinkpad/tp_smapi/pull/81.patch
|
| 9 | Upstream-Status: https://github.com/linux-thinkpad/tp_smapi/pull/81
|
| 10 | ---
|
| 11 | tp_smapi.c | 2 +-
|
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-)
|
| 13 |
|
| 14 | diff --git a/tp_smapi.c b/tp_smapi.c
|
| 15 | index 39ac601..cb01212 100644
|
| 16 | |
| 17 | |
| 18 | @@ -669,7 +669,7 @@ static ssize_t show_tp_ec_bat_str(u8 arg0, int offset, int maxlen,
|
| 19 | ret = read_tp_ec_row(arg0, bat, 0, row);
|
| 20 | if (ret)
|
| 21 | return ret;
|
| 22 | - strncpy(buf, (char *)row+offset, maxlen);
|
| 23 | + strscpy(buf, (char *)row+offset, maxlen);
|
| 24 | buf[maxlen] = 0;
|
| 25 | strcat(buf, "\n");
|
| 26 | return strlen(buf);
|