@@ -57,8 +57,8 @@ acpi_tb_find_table(char *signature,
memset(&header, 0, sizeof(struct acpi_table_header));
ACPI_COPY_NAMESEG(header.signature, signature);
- strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
- strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+ memcpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
+ memcpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
/* Search for the table */
@@ -522,7 +522,7 @@ typedef u64 acpi_integer;
#define ACPI_COPY_NAMESEG(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src)))
#else
#define ACPI_COMPARE_NAMESEG(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAMESEG_SIZE))
-#define ACPI_COPY_NAMESEG(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE))
+#define ACPI_COPY_NAMESEG(dest, src) (strtomem (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src))))
#endif
/* Support for the special RSDP signature (8 characters) */
strncpy() is deprecated for NUL-terminated destination buffers[1]. Use strtomem() for ACPI_COPY_NAMESEG() as destinations are length-bounded, and not all of them require NUL termination. Also replace strncpy() with memcpy() for copying header.oem_id and header.oem_table_id [1] https://github.com/KSPP/linux/issues/90 Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com> --- drivers/acpi/acpica/tbfind.c | 4 ++-- include/acpi/actypes.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)