From 96c85f2f2e21a575d10f57b6c18ed76871dd5058 Mon Sep 17 00:00:00 2001 From: Jake Park Date: Fri, 30 Jun 2023 17:59:56 +0900 Subject: [PATCH] gpu: nvgpu: replace %p with %px for cache name %p prints (ptrval) instead of hexadecimal value until it gathers enough entropy. During early boot stage, it can make invalid cache name like "nvgpu-cache-0x (ptrval)-128-1" and that kind of cache name can make failure of kmem_cache_create(). To avoid invalid cache name, replace %p with %px for cache name. Bug 4100509 Change-Id: Iae0ae9cf1a30ec91aeddddaafda9e7376fc80796 Signed-off-by: Jake Park Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2929270 Reviewed-by: Dmitry Pervushin Reviewed-by: Kwangwoo Lee GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/kmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/kmem.c b/drivers/gpu/nvgpu/os/linux/kmem.c index 395cc458f..34b5b08a9 100644 --- a/drivers/gpu/nvgpu/os/linux/kmem.c +++ b/drivers/gpu/nvgpu/os/linux/kmem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -622,7 +622,7 @@ struct nvgpu_kmem_cache *nvgpu_kmem_cache_create(struct gk20a *g, size_t size) cache->g = g; snprintf(cache->name, sizeof(cache->name), - "nvgpu-cache-0x%p-%d-%d", g, (int)size, + "nvgpu-cache-0x%px-%d-%d", g, (int)size, atomic_inc_return(&kmem_cache_id)); cache->cache = kmem_cache_create(cache->name, size, size, 0, NULL);