diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-11-02 15:01:33 -1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-11-02 15:01:33 -1000 |
commit | e5760335882bd91137873b8f2230b6c1f91da52b (patch) | |
tree | 9ac104dc9516aeeb5f294d1feb912d721e49f4f8 /drivers/char | |
parent | 431f1051884e38d2a5751e4731d69b2ff289ee56 (diff) | |
parent | b00839ca4cca8aa9641c121c848a553d6220ce70 (diff) | |
download | linux-e5760335882bd91137873b8f2230b6c1f91da52b.tar.gz linux-e5760335882bd91137873b8f2230b6c1f91da52b.tar.bz2 linux-e5760335882bd91137873b8f2230b6c1f91da52b.zip |
Merge tag 'for-linus-6.7-1' of https://github.com/cminyard/linux-ipmi
Pull IPMI update from Corey Minyard:
"Only one change, and I would normally just wait, but it will make the
people trying to get rid of strncpy happy. Its a good change, anyway"
* tag 'for-linus-6.7-1' of https://github.com/cminyard/linux-ipmi:
ipmi: refactor deprecated strncpy
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 11 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 2 |
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 186f1fee7534..d6f14279684d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -5377,20 +5377,15 @@ static void send_panic_events(struct ipmi_smi *intf, char *str) j = 0; while (*p) { - int size = strlen(p); + int size = strnlen(p, 11); - if (size > 11) - size = 11; data[0] = 0; data[1] = 0; data[2] = 0xf0; /* OEM event without timestamp. */ data[3] = intf->addrinfo[0].address; data[4] = j++; /* sequence # */ - /* - * Always give 11 bytes, so strncpy will fill - * it with zeroes for me. - */ - strncpy(data+5, p, 11); + + memcpy_and_pad(data+5, 11, p, size, '\0'); p += size; ipmi_panic_request_and_wait(intf, &addr, &msg); diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index df8dd50b4cbe..1f7600c361e6 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -1945,7 +1945,7 @@ static int new_ssif_client(int addr, char *adapter_name, } } - strncpy(addr_info->binfo.type, DEVICE_NAME, + strscpy(addr_info->binfo.type, DEVICE_NAME, sizeof(addr_info->binfo.type)); addr_info->binfo.addr = addr; addr_info->binfo.platform_data = addr_info; |