Skip to contentSkip to conversation

drm/i915: Fix CSR MMIO address check

PATCH In review Takashi Iwai 4 participants 4 messages Sep 9, 2015 – Sep 10, 2015

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

PATCH 1/1 drm/i915: Fix CSR MMIO address check

Fix a wrong logical AND (&&) used for the range check of CSR MMIO.

Spotted nicely by gcc -Wlogical-op flag:
drivers/gpu/drm/i915/intel_csr.c: In function ‘finish_csr_load’:
drivers/gpu/drm/i915/intel_csr.c:353:41: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Fixes eb805623d8b1 ('drm/i915/skl: Add support to load SKL CSR firmware.')
Cc <[email protected]> # v4.2
---
 drivers/gpu/drm/i915/intel_csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_csr.c +1 -1
index ba1ae031e6fd..d0f1b8d833cd 100644
@@ -350,7 +350,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
 	}
 	csr->mmio_count = dmc_header->mmio_count;
 	for (i = 0; i < dmc_header->mmio_count; i++) {
-		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE &&
+		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
 			dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
 			DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
 						dmc_header->mmioaddr[i]);
Signature · 6 lines
2.5.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 9 lines · Takashi Iwai

Fix a wrong logical AND (&&) used for the range check of CSR MMIO.

Spotted nicely by gcc -Wlogical-op flag:
drivers/gpu/drm/i915/intel_csr.c: In function ‘finish_csr_load’:
drivers/gpu/drm/i915/intel_csr.c:353:41: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Fixes eb805623d8b1 ('drm/i915/skl: Add support to load SKL CSR firmware.')
Cc <[email protected]> # v4.2

Oops. Reviewed-by: Daniel Vetter <[email protected]> and for Jani. -Daniel

Quoted 20 lines
---
 drivers/gpu/drm/i915/intel_csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_csr.c +1 -1
index ba1ae031e6fd..d0f1b8d833cd 100644
@@ -350,7 +350,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
 	}
 	csr->mmio_count = dmc_header->mmio_count;
 	for (i = 0; i < dmc_header->mmio_count; i++) {
-		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE &&
+		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
 			dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
 			DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
 						dmc_header->mmioaddr[i]);
Signature · 1 line
2.5.1
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
#2 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Takashi Iwai

Fix a wrong logical AND (&&) used for the range check of CSR MMIO.

Spotted nicely by gcc -Wlogical-op flag:
drivers/gpu/drm/i915/intel_csr.c: In function ‘finish_csr_load’:
drivers/gpu/drm/i915/intel_csr.c:353:41: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Quoted 5 lines
Quoted 3 lines
Fixes eb805623d8b1 ('drm/i915/skl: Add support to load SKL CSR firmware.')
Cc <[email protected]> # v4.2

Oops. Reviewed-by: Daniel Vetter <[email protected]> and for Jani. -Daniel

The same change is submitted part of dmc-redesign patch series.
http://lists.freedesktop.org/archives/intel-gfx/2015-August/074447.html

-Animesh

Quoted 5 lines
Quoted 5 lines
---
  drivers/gpu/drm/i915/intel_csr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_csr.c +1 -1
index ba1ae031e6fd..d0f1b8d833cd 100644
@@ -350,7 +350,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
  	}
  	csr->mmio_count = dmc_header->mmio_count;
  	for (i = 0; i < dmc_header->mmio_count; i++) {
-		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE &&
+		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
  			dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
  			DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
  						dmc_header->mmioaddr[i]);
Signature · 1 line
2.5.1

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

maintainer
#3 lore raw
Quoted 8 lines · Animesh Manna
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Takashi Iwai

Fix a wrong logical AND (&&) used for the range check of CSR MMIO.

Spotted nicely by gcc -Wlogical-op flag:
drivers/gpu/drm/i915/intel_csr.c: In function ‘finish_csr_load’:
drivers/gpu/drm/i915/intel_csr.c:353:41: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Fixes eb805623d8b1 ('drm/i915/skl: Add support to load SKL CSR firmware.')
Cc <[email protected]> # v4.2

Oops. Reviewed-by: Daniel Vetter <[email protected]> and for Jani. -Daniel

The same change is submitted part of dmc-redesign patch series.
http://lists.freedesktop.org/archives/intel-gfx/2015-August/074447.html

Pushed Takashi's patch to drm-intel-next-fixes, thanks for the patch and review.

When there are multiple patches doing the same thing, I usually pick the earliest submitted. However Animesh's patch did not apply because it is at the end of a long series. Indeed you should always prefer doing fixes first, especially if they need to be backported to stable kernels. I took the liberty of adding Animesh's contribution as Reviewed-by.

BR,
Jani.

Quoted 28 lines

-Animesh

Quoted 5 lines
Quoted 5 lines
---
  drivers/gpu/drm/i915/intel_csr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_csr.c +1 -1
index ba1ae031e6fd..d0f1b8d833cd 100644
@@ -350,7 +350,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
  	}
  	csr->mmio_count = dmc_header->mmio_count;
  	for (i = 0; i < dmc_header->mmio_count; i++) {
-		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE &&
+		if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
  			dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
  			DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
  						dmc_header->mmioaddr[i]);
Signature · 1 line
2.5.1

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

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx