diff options
author | Ricardo Lopes <ricardoapl.dev@gmail.com> | 2023-10-06 17:12:24 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-07 11:13:49 +0200 |
commit | 31e2d4cde1424e8068c2c675805c251365c0f522 (patch) | |
tree | 6a36ebffd973b4ca32afc6c5233072c9cb71daa9 | |
parent | 388fd6a87f7fc41d75720bd8d0b84bd3f2f49f7a (diff) | |
download | linux-stable-31e2d4cde1424e8068c2c675805c251365c0f522.tar.gz linux-stable-31e2d4cde1424e8068c2c675805c251365c0f522.tar.bz2 linux-stable-31e2d4cde1424e8068c2c675805c251365c0f522.zip |
staging: qlge: Replace strncpy with strscpy
Reported by checkpatch:
WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy
Signed-off-by: Ricardo Lopes <ricardoapl.dev@gmail.com>
Link: https://lore.kernel.org/r/20231006161240.28048-1-ricardoapl.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/qlge/qlge_dbg.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index c7e865f515cf..5f08a8492da4 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -696,7 +696,7 @@ static void qlge_build_coredump_seg_header(struct mpi_coredump_segment_header *s seg_hdr->cookie = MPI_COREDUMP_COOKIE; seg_hdr->seg_num = seg_number; seg_hdr->seg_size = seg_size; - strncpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1); + strscpy(seg_hdr->description, desc, sizeof(seg_hdr->description)); } /* @@ -737,7 +737,7 @@ int qlge_core_dump(struct qlge_adapter *qdev, struct qlge_mpi_coredump *mpi_core sizeof(struct mpi_coredump_global_header); mpi_coredump->mpi_global_header.image_size = sizeof(struct qlge_mpi_coredump); - strncpy(mpi_coredump->mpi_global_header.id_string, "MPI Coredump", + strscpy(mpi_coredump->mpi_global_header.id_string, "MPI Coredump", sizeof(mpi_coredump->mpi_global_header.id_string)); /* Get generic NIC reg dump */ @@ -1225,7 +1225,7 @@ static void qlge_gen_reg_dump(struct qlge_adapter *qdev, sizeof(struct mpi_coredump_global_header); mpi_coredump->mpi_global_header.image_size = sizeof(struct qlge_reg_dump); - strncpy(mpi_coredump->mpi_global_header.id_string, "MPI Coredump", + strscpy(mpi_coredump->mpi_global_header.id_string, "MPI Coredump", sizeof(mpi_coredump->mpi_global_header.id_string)); /* segment 16 */ |