diff options
| author | Thorsten Blum <[email protected]> | 2025-08-06 09:05:09 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-08-19 10:55:16 +0000 |
| commit | 300a0cfe9f375b2843bcb331bcfa7503475ef5dd (patch) | |
| tree | 290ac6cee2ce4d61a8d284ac164bf9801ad739b1 /drivers/cdx/controller/cdx_rpmsg.c | |
| parent | fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable() (diff) | |
| download | kernel-300a0cfe9f375b2843bcb331bcfa7503475ef5dd.tar.gz kernel-300a0cfe9f375b2843bcb331bcfa7503475ef5dd.zip | |
cdx: Fix off-by-one error in cdx_rpmsg_probe()
In cdx_rpmsg_probe(), strscpy() is incorrectly called with the length of
the source string (excluding the NUL terminator) rather than the size of
the destination buffer. This results in one character less being copied
from 'cdx_rpmsg_id_table[0].name' to 'chinfo.name'.
Use the destination buffer size instead to ensure the name is copied
correctly.
Cc: stable <[email protected]>
Fixes: 2a226927d9b8 ("cdx: add rpmsg communication channel for CDX")
Signed-off-by: Thorsten Blum <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/cdx/controller/cdx_rpmsg.c')
| -rw-r--r-- | drivers/cdx/controller/cdx_rpmsg.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/cdx/controller/cdx_rpmsg.c b/drivers/cdx/controller/cdx_rpmsg.c index 04b578a0be17..61f1a290ff08 100644 --- a/drivers/cdx/controller/cdx_rpmsg.c +++ b/drivers/cdx/controller/cdx_rpmsg.c @@ -129,8 +129,7 @@ static int cdx_rpmsg_probe(struct rpmsg_device *rpdev) chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = rpdev->dst; - strscpy(chinfo.name, cdx_rpmsg_id_table[0].name, - strlen(cdx_rpmsg_id_table[0].name)); + strscpy(chinfo.name, cdx_rpmsg_id_table[0].name, sizeof(chinfo.name)); cdx_mcdi->ept = rpmsg_create_ept(rpdev, cdx_rpmsg_cb, NULL, chinfo); if (!cdx_mcdi->ept) { |
