Skip to contentSkip to conversation

drm/i915: fix itnull.cocci warnings (fwd)

PATCH In review Julia Lawall 4 participants 6 messages Jan 18, 2016 – Jan 20, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix itnull.cocci warnings (fwd)

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

 intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -16498,7 +16498,7 @@ void intel_modeset_preclose(struct drm_d
 		struct intel_flip_work *work;
 
 		list_for_each_entry(work, &crtc->flip_work, head) {
-			if (work && work->event &&
+			if (work->event &&
 			    work->event->base.file_priv == file) {
 				kfree(work->event);
 				work->event = NULL;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw
Quoted 9 lines · Julia Lawall

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

Against which tree is this? I can't find this anywhere like that ... -Daniel

Quoted 19 lines
 intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -16498,7 +16498,7 @@ void intel_modeset_preclose(struct drm_d
 		struct intel_flip_work *work;
 
 		list_for_each_entry(work, &crtc->flip_work, head) {
-			if (work && work->event &&
+			if (work->event &&
 			    work->event->base.file_priv == file) {
 				kfree(work->event);
 				work->event = NULL;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

I expect this is the script she mentions:
https://github.com/coccinelle/coccinellery/blob/master/itnull/itnull.cocci

Julia is one of the authors of Coccinelle, and the author of that script :)

Quoted 23 lines · Daniel Vetter
Quoted 9 lines · Julia Lawall

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

Against which tree is this? I can't find this anywhere like that ... -Daniel

Quoted 9 lines
 intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -16498,7 +16498,7 @@ void intel_modeset_preclose(struct drm_d
 		struct intel_flip_work *work;
 
Quoted 11 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 		list_for_each_entry(work, &crtc->flip_work, head) {
-			if (work && work->event &&
+			if (work->event &&
 			    work->event->base.file_priv == file) {
 				kfree(work->event);
 				work->event = NULL;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 4 lines · Eric Engestrom

I expect this is the script she mentions:
https://github.com/coccinelle/coccinellery/blob/master/itnull/itnull.cocci

Julia is one of the authors of Coccinelle, and the author of that script :)

I get how these patches get created, I just can't find a tree anywhere where this applies. So I wonder what it was generated against ... -Daniel

Quoted 37 lines · Daniel Vetter
Quoted 34 lines · Julia Lawall
Quoted 9 lines

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

Against which tree is this? I can't find this anywhere like that ... -Daniel

Quoted 19 lines
 intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -16498,7 +16498,7 @@ void intel_modeset_preclose(struct drm_d
 		struct intel_flip_work *work;
 
 		list_for_each_entry(work, &crtc->flip_work, head) {
-			if (work && work->event &&
+			if (work->event &&
 			    work->event->base.file_priv == file) {
 				kfree(work->event);
 				work->event = NULL;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Daniel Vetter
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Julia Lawall

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Quoted 8 lines
Quoted 6 lines

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

Against which tree is this? I can't find this anywhere like that ...

I don't know. It may be against a submitted patch.

In case it turns out to be useful, I forgot:

Quoted 11 lines

-Daniel

Quoted 9 lines
 intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -16498,7 +16498,7 @@ void intel_modeset_preclose(struct drm_d
 		struct intel_flip_work *work;
 
Quoted 16 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 		list_for_each_entry(work, &crtc->flip_work, head) {
-			if (work && work->event &&
+			if (work->event &&
 			    work->event->base.file_priv == file) {
 				kfree(work->event);
 				work->event = NULL;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Daniel Vetter

Op 18-01-16 om 18:20 schreef Daniel Vetter:

Quoted 12 lines · Julia Lawall
Quoted 9 lines

List_for_each entry binds its first argument to an offset from the list pointer, so this should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

Please take the patch only if it's a positive warning. Thanks!

Against which tree is this? I can't find this anywhere like that ...

Looks to like it happens in my tree.

drm/i915: Convert flip_work to a list.

~Maarten
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel