ANDROID: debug_kinfo: Replace strlcpy() with compatible and safer variant strscpy()

strlcpy() has now been formally removed from the kernel due to the risks it poses.

Fixes the following build error:

  drivers/android/debug_kinfo.c:161:2: error:
    call to undeclared library function 'strlcpy' with type 'unsigned long (char *, const char *, unsigned long)';
      ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    161 |         strlcpy(info->last_uts_release, init_utsname()->release, sizeof(info->last_uts_release));
        |         ^

Fixes: d26270061a ("string: Remove strlcpy()")
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ib2b863c07676495626dd03af762ddb201d326127
This commit is contained in:
Lee Jones
2024-03-26 09:26:45 +00:00
parent bc77380243
commit 20039e646d
+1 -1
View File
@@ -158,7 +158,7 @@ static int debug_kinfo_probe(struct platform_device *pdev)
info->_markers_pa = (u64)__pa_symbol((volatile void *)kallsyms_markers);
info->thread_size = THREAD_SIZE;
info->swapper_pg_dir_pa = (u64)__pa_symbol(swapper_pg_dir);
strlcpy(info->last_uts_release, init_utsname()->release, sizeof(info->last_uts_release));
strscpy(info->last_uts_release, init_utsname()->release, sizeof(info->last_uts_release));
info->enabled_modules_tree_lookup = IS_ENABLED(CONFIG_MODULES_TREE_LOOKUP);
info->mod_kallsyms_offset = offsetof(struct module, kallsyms);