drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd)
Subsystems (3)
PATCH 1/1 drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd)
This is a false positive, but I wonder if it is really necessary to put the assignment in the conditional test expression.
julia
---------- Forwarded message ----------
Date: Tue, 28 Nov 2017 13:23:36 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings
CC: [email protected]
CC: [email protected]
TO: Ben Skeggs <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 110. drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 111.
PTR_ERR should access the value just tested by IS_ERR
Semantic patch information:
There can be false positives in the patch case, where it is the call to IS_ERR that is wrong.
Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
---
Please take the patch only if it's a positive warning. Thanks!
uvmm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +3 -2
@@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmreturn ret;if (IS_ERR ((memory =nvkm_umem_search (client, handle)))) { -VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle,PTR_ERR (memory)); -return PTR_ERR (memory); +VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle, +PTR_ERR ((memory =nvkm_umem_search (client, handle)))); +return PTR_ERR ((memory =nvkm_umem_search (client, handle))); }mutex_lock (&vmm->mutex);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi julia,
I think it would be better to extract the assignment out of the if clause. Then you'll get something like this:
memory = ...;
if (IS_ERR(memory)) {
....
}
so, to answer your question: no, it isn't necessary.
Quoted 54 lines · Julia Lawall
This is a false positive, but I wonder if it is really necessary to put the assignment in the conditional test expression.
julia
---------- Forwarded message ----------
Date: Tue, 28 Nov 2017 13:23:36 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm/nouveau/mmu: fixodd_ptr_err.cocciwarningsCC: [email protected]
CC: [email protected]
TO: Ben Skeggs <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent
IS_ERRandPTR_ERRon line 110. drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistentIS_ERRandPTR_ERRon line 111.
PTR_ERRshould access the value just tested byIS_ERRSemantic patch information:
There can be false positives in the patch case, where it is the call toIS_ERRthat is wrong.Generated by:
scripts/coccinelle/tests/odd_ptr_err.cocciFixes 920d2b5ef215 ("drm/nouveau/mmu: define user interfaces to mmu vmm opertaions")Signed-off-by Fengguang Wu <[email protected]>---
Please take the patch only if it's a positive warning. Thanks!
uvmm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +3
-2@@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmreturn ret;if (IS_ERR ((memory =nvkm_umem_search (client, handle)))) { -VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle,PTR_ERR (memory)); -return PTR_ERR (memory); +VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle, +PTR_ERR ((memory =nvkm_umem_search (client, handle)))); +return PTR_ERR ((memory =nvkm_umem_search (client, handle))); }mutex_lock (&vmm->mutex);
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 11 lines · Karol Herbst
Hi julia,
I think it would be better to extract the assignment out of the if clause. Then you'll get something like this:
memory = ...;
if (IS_ERR(memory)) {
....
}so, to answer your question: no, it isn't necessary.
Will someone take care of it? I'm just the 0-day proxy :)
julia
Quoted 54 lines · Julia Lawall
Quoted 53 lines
This is a false positive, but I wonder if it is really necessary to put the assignment in the conditional test expression.
julia
---------- Forwarded message ----------
Date: Tue, 28 Nov 2017 13:23:36 +0800
From: kbuild test robot <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm/nouveau/mmu: fixodd_ptr_err.cocciwarningsCC: [email protected]
CC: [email protected]
TO: Ben Skeggs <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent
IS_ERRandPTR_ERRon line 110. drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistentIS_ERRandPTR_ERRon line 111.
PTR_ERRshould access the value just tested byIS_ERRSemantic patch information:
There can be false positives in the patch case, where it is the call toIS_ERRthat is wrong.Generated by:
scripts/coccinelle/tests/odd_ptr_err.cocciFixes 920d2b5ef215 ("drm/nouveau/mmu: define user interfaces to mmu vmm opertaions")Signed-off-by Fengguang Wu <[email protected]>---
Please take the patch only if it's a positive warning. Thanks!
uvmm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +3
-2@@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvmreturn ret;if (IS_ERR ((memory =nvkm_umem_search (client, handle)))) { -VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle,PTR_ERR (memory)); -return PTR_ERR (memory); +VMM_DEBUG (vmm,"memory %016llx %ld\n" , handle, +PTR_ERR ((memory =nvkm_umem_search (client, handle)))); +return PTR_ERR ((memory =nvkm_umem_search (client, handle))); }
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +0
-0mutex_lock (&vmm->mutex);_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel