* [PATCH] drm/amdgpu/psp: use proper vmalloc API
@ 2022-05-10 14:58 Alex Deucher
2022-05-10 15:18 ` Andrey Grodzovsky
0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2022-05-10 14:58 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher, kernel test robot
Use kvmalloc and kvfree.
Fixes: 31aad22e2b3c ("drm/amdgpu/psp: Add vbflash sysfs interface support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index bbc232697069..214e4e89a028 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -3459,7 +3459,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
/* Safeguard against memory drain */
if (adev->psp.vbflash_image_size > AMD_VBIOS_FILE_MAX_SIZE_B) {
dev_err(adev->dev, "File size cannot exceed %u", AMD_VBIOS_FILE_MAX_SIZE_B);
- vfree(adev->psp.vbflash_tmp_buf);
+ kvfree(adev->psp.vbflash_tmp_buf);
adev->psp.vbflash_tmp_buf = NULL;
adev->psp.vbflash_image_size = 0;
return -ENOMEM;
@@ -3467,7 +3467,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
/* TODO Just allocate max for now and optimize to realloc later if needed */
if (!adev->psp.vbflash_tmp_buf) {
- adev->psp.vbflash_tmp_buf = vmalloc(AMD_VBIOS_FILE_MAX_SIZE_B);
+ adev->psp.vbflash_tmp_buf = kvmalloc(AMD_VBIOS_FILE_MAX_SIZE_B, GFP_KERNEL);
if (!adev->psp.vbflash_tmp_buf)
return -ENOMEM;
}
@@ -3514,7 +3514,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,
amdgpu_bo_free_kernel(&fw_buf_bo, &fw_pri_mc_addr, &fw_pri_cpu_addr);
rel_buf:
- vfree(adev->psp.vbflash_tmp_buf);
+ kvfree(adev->psp.vbflash_tmp_buf);
adev->psp.vbflash_tmp_buf = NULL;
adev->psp.vbflash_image_size = 0;
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu/psp: use proper vmalloc API
2022-05-10 14:58 [PATCH] drm/amdgpu/psp: use proper vmalloc API Alex Deucher
@ 2022-05-10 15:18 ` Andrey Grodzovsky
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Grodzovsky @ 2022-05-10 15:18 UTC (permalink / raw)
To: Alex Deucher, amd-gfx; +Cc: kernel test robot
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Andrey
On 2022-05-10 10:58, Alex Deucher wrote:
> Use kvmalloc and kvfree.
>
> Fixes: 31aad22e2b3c ("drm/amdgpu/psp: Add vbflash sysfs interface support")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index bbc232697069..214e4e89a028 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -3459,7 +3459,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
> /* Safeguard against memory drain */
> if (adev->psp.vbflash_image_size > AMD_VBIOS_FILE_MAX_SIZE_B) {
> dev_err(adev->dev, "File size cannot exceed %u", AMD_VBIOS_FILE_MAX_SIZE_B);
> - vfree(adev->psp.vbflash_tmp_buf);
> + kvfree(adev->psp.vbflash_tmp_buf);
> adev->psp.vbflash_tmp_buf = NULL;
> adev->psp.vbflash_image_size = 0;
> return -ENOMEM;
> @@ -3467,7 +3467,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
>
> /* TODO Just allocate max for now and optimize to realloc later if needed */
> if (!adev->psp.vbflash_tmp_buf) {
> - adev->psp.vbflash_tmp_buf = vmalloc(AMD_VBIOS_FILE_MAX_SIZE_B);
> + adev->psp.vbflash_tmp_buf = kvmalloc(AMD_VBIOS_FILE_MAX_SIZE_B, GFP_KERNEL);
> if (!adev->psp.vbflash_tmp_buf)
> return -ENOMEM;
> }
> @@ -3514,7 +3514,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,
> amdgpu_bo_free_kernel(&fw_buf_bo, &fw_pri_mc_addr, &fw_pri_cpu_addr);
>
> rel_buf:
> - vfree(adev->psp.vbflash_tmp_buf);
> + kvfree(adev->psp.vbflash_tmp_buf);
> adev->psp.vbflash_tmp_buf = NULL;
> adev->psp.vbflash_image_size = 0;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-10 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 14:58 [PATCH] drm/amdgpu/psp: use proper vmalloc API Alex Deucher
2022-05-10 15:18 ` Andrey Grodzovsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.