mm: page_owner: Fix -Wstrlcpy-strlcat-size

mm/page_owner.c:944:39: error:
 size argument in 'strlcpy' call appears to be size of the source;
 expected the size of the destination [-Werror,-Wstrlcpy-strlcat-size]
  944 |         strlcpy(call_site->name, buf, strlen(buf));
      |                                       ~~~~~~~^~~~
mm/page_owner.c:944:32: note:
 change size argument to be the size of the destination
  944 |         strlcpy(call_site->name, buf, strlen(buf));
      |                                       ^~~~~~~~~~~
      |                                       sizeof(call_site->name)

https://github.com/LineageOS/android_kernel_qcom_sm8450/blob/lineage-20/drivers/soc/qcom/minidump_memory.c#L692
contains the same code.

Change-Id: Id06f67fe18f2e00dd180afaf99c7577787198cc3
Signed-off-by: Sevenrock <sevenrock@hotmail.de>
This commit is contained in:
Sevenrock
2024-12-10 23:34:39 +01:00
committed by Michael Bestas
parent 20d7404d1e
commit 365ffb9892

View File

@@ -941,7 +941,7 @@ static ssize_t page_owner_call_site_write(struct file *file,
if (!call_site)
return -ENOMEM;
strlcpy(call_site->name, buf, strlen(buf));
strlcpy(call_site->name, buf, strlen(call_site->name));
mutex_lock(&accounted_call_site_lock);
list_add_tail(&call_site->list, &accounted_call_site_list);
mutex_unlock(&accounted_call_site_lock);