drm/amdgpu: add selftest framework for UMSCH
Hello Lang Yu,
The patch 5d5eac7e8303: "drm/amdgpu: add selftest framework for UMSCH" from Jun 21, 2023 (linux-next), leads to the following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c:338 setup_umsch_mm_test() warn: unsigned error codes 'test->pasid'
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c
319 static int setup_umsch_mm_test(struct amdgpu_device *adev,
320 struct umsch_mm_test *test)
321 {
322 struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
323 int r;
324
325 test->vm_cntx_cntl = hub->vm_cntx_cntl;
326
327 test->vm = kzalloc(sizeof(*test->vm), GFP_KERNEL);
328 if (!test->vm) {
329 r = -ENOMEM;
330 return r;
331 }
332
333 r = amdgpu_vm_init(adev, test->vm, -1);
334 if (r)
335 goto error_free_vm;
336
337 test->pasid = amdgpu_pasid_alloc(16);
--> 338 if (test->pasid < 0) {
^^^^^^^^^^^^^^^Unsigned can't be less than zero.
339 r = test->pasid;
340 goto error_fini_vm;
341 }
342
343 r = amdgpu_bo_create_kernel(adev, sizeof(struct umsch_mm_test_ctx_data),regards,
dan carpenter
On 09/06/ , Dan Carpenter wrote:
Thanks for reporting this bug. Can you give a link to this bug report? Commit message requests it. ("Reported-by: should be immediately followed by Link: with a URL to the report")
Regards,
Lang
Quoted 41 lines
Hello Lang Yu,
The patch
5d5eac7e8303: "drm/amdgpu: add selftest framework for UMSCH" from Jun 21, 2023 (linux-next), leads to the following Smatch static checker warning:drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c:338 setup_umsch_mm_test() warn: unsigned error codes 'test->pasid'
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c319 static int setup_umsch_mm_test(struct amdgpu_device *adev, 320 struct umsch_mm_test *test) 321 { 322 struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)]; 323 int r; 324 325 test->vm_cntx_cntl = hub->vm_cntx_cntl; 326 327 test->vm = kzalloc(sizeof(*test->vm), GFP_KERNEL); 328 if (!test->vm) { 329 r = -ENOMEM; 330 return r; 331 } 332 333 r = amdgpu_vm_init(adev, test->vm, -1); 334 if (r) 335 goto error_free_vm; 336 337 test->pasid = amdgpu_pasid_alloc(16); --> 338 if (test->pasid < 0) { ^^^^^^^^^^^^^^^Unsigned can't be less than zero.
339 r = test->pasid; 340 goto error_fini_vm; 341 } 342 343 r = amdgpu_bo_create_kernel(adev, sizeof(struct umsch_mm_test_ctx_data),regards,
dan carpenter
Quoted 5 lines · Lang Yu
On 09/06/ , Dan Carpenter wrote:
Thanks for reporting this bug. Can you give a link to this bug report? Commit message requests it. ("Reported-by: should be immediately followed by Link: with a URL to the report")
My email hasn't hit lore.kernel.org yet... Presumably it will in a bit. We could link to yours or swap out the the message-id.
https://lore.kernel.org/all/ZPhddADtKmOuVyDq@lang-desktop/
regards,
dan carpenter
Quoted 5 lines · Lang Yu
On 09/06/ , Dan Carpenter wrote:
Thanks for reporting this bug. Can you give a link to this bug report? Commit message requests it. ("Reported-by: should be immediately followed by Link: with a URL to the report")
For something reported on the mailing list you can just provide the link the the mailing list archive:
Alex
Quoted 45 lines
Regards,
LangQuoted 41 lines
Hello Lang Yu,
The patch
5d5eac7e8303: "drm/amdgpu: add selftest framework for UMSCH" from Jun 21, 2023 (linux-next), leads to the following Smatch static checker warning:drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c:338 setup_umsch_mm_test() warn: unsigned error codes 'test->pasid'
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c319 static int setup_umsch_mm_test(struct amdgpu_device *adev, 320 struct umsch_mm_test *test) 321 { 322 struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)]; 323 int r; 324 325 test->vm_cntx_cntl = hub->vm_cntx_cntl; 326 327 test->vm = kzalloc(sizeof(*test->vm), GFP_KERNEL); 328 if (!test->vm) { 329 r = -ENOMEM; 330 return r; 331 } 332 333 r = amdgpu_vm_init(adev, test->vm, -1); 334 if (r) 335 goto error_free_vm; 336 337 test->pasid = amdgpu_pasid_alloc(16); --> 338 if (test->pasid < 0) { ^^^^^^^^^^^^^^^Unsigned can't be less than zero.
339 r = test->pasid; 340 goto error_fini_vm; 341 } 342 343 r = amdgpu_bo_create_kernel(adev, sizeof(struct umsch_mm_test_ctx_data),regards,
dan carpenter