diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/2877-drm-amdgpu-replace-simple_strtol-by-kstrtou32.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.19.8/2877-drm-amdgpu-replace-simple_strtol-by-kstrtou32.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/2877-drm-amdgpu-replace-simple_strtol-by-kstrtou32.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/2877-drm-amdgpu-replace-simple_strtol-by-kstrtou32.patch new file mode 100644 index 00000000..dc60e9f7 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/2877-drm-amdgpu-replace-simple_strtol-by-kstrtou32.patch @@ -0,0 +1,38 @@ +From 8d4b7733f4c17cc04cf95d597aadf6bff056744f Mon Sep 17 00:00:00 2001 +From: Wang Xiayang <xywang.sjtu@sjtu.edu.cn> +Date: Mon, 15 Jul 2019 16:53:01 +0800 +Subject: [PATCH 2877/2940] drm/amdgpu: replace simple_strtol() by kstrtou32() + +The simple_strtol() function is deprecated. kstrto[l,u32]() is +the correct replacement as it can properly handle overflows. + +This patch replaces the deprecated simple_strtol() use introduced recently. +As clk is of type uint32_t, we are safe to use kstrtou32(). + +It is also safe to return zero on string parsing error, +similar to the case of returning zero if buf is empty in parse_clk(). + +Fixes: bb5a2bdf36a8 ("drm/amdgpu: support dpm level modification under virtualization v3") +Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn> +Signed-off-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +index 1f0bd4d16475..1d68729a9a6b 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +@@ -386,7 +386,8 @@ static uint32_t parse_clk(char *buf, bool min) + if (!ptr) + break; + ptr+=2; +- clk = simple_strtoul(ptr, NULL, 10); ++ if (kstrtou32(ptr, 10, &clk)) ++ return 0; + } while (!min); + + return clk * 100; +-- +2.17.1 + |