* [PATCH] drm/vc4: hdmi: Fix off by ones in vc4_hdmi_read/write()
@ 2020-09-10 10:07 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-09-10 10:07 UTC (permalink / raw)
To: Eric Anholt
Cc: Dave Stevenson, David Airlie, kernel-janitors, dri-devel,
Maxime Ripard
The variant->registers[] has ->num_registers elements so the >
comparison needs to be changes to >= to prevent an out of bounds
access.
Fixes: 311e305fdb4e ("drm/vc4: hdmi: Implement a register layout abstraction")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
index a5f1354e3e06..47364bd3960d 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
@@ -398,7 +398,7 @@ static inline u32 vc4_hdmi_read(struct vc4_hdmi *hdmi,
const struct vc4_hdmi_variant *variant = hdmi->variant;
void __iomem *base;
- if (reg > variant->num_registers) {
+ if (reg >= variant->num_registers) {
dev_warn(&hdmi->pdev->dev,
"Invalid register ID %u\n", reg);
return 0;
@@ -424,7 +424,7 @@ static inline void vc4_hdmi_write(struct vc4_hdmi *hdmi,
const struct vc4_hdmi_variant *variant = hdmi->variant;
void __iomem *base;
- if (reg > variant->num_registers) {
+ if (reg >= variant->num_registers) {
dev_warn(&hdmi->pdev->dev,
"Invalid register ID %u\n", reg);
return;
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/vc4: hdmi: Fix off by ones in vc4_hdmi_read/write()
@ 2020-09-10 10:07 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-09-10 10:07 UTC (permalink / raw)
To: Eric Anholt
Cc: Dave Stevenson, David Airlie, kernel-janitors, dri-devel,
Maxime Ripard
The variant->registers[] has ->num_registers elements so the >
comparison needs to be changes to >= to prevent an out of bounds
access.
Fixes: 311e305fdb4e ("drm/vc4: hdmi: Implement a register layout abstraction")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
index a5f1354e3e06..47364bd3960d 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
@@ -398,7 +398,7 @@ static inline u32 vc4_hdmi_read(struct vc4_hdmi *hdmi,
const struct vc4_hdmi_variant *variant = hdmi->variant;
void __iomem *base;
- if (reg > variant->num_registers) {
+ if (reg >= variant->num_registers) {
dev_warn(&hdmi->pdev->dev,
"Invalid register ID %u\n", reg);
return 0;
@@ -424,7 +424,7 @@ static inline void vc4_hdmi_write(struct vc4_hdmi *hdmi,
const struct vc4_hdmi_variant *variant = hdmi->variant;
void __iomem *base;
- if (reg > variant->num_registers) {
+ if (reg >= variant->num_registers) {
dev_warn(&hdmi->pdev->dev,
"Invalid register ID %u\n", reg);
return;
--
2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/vc4: hdmi: Fix off by ones in vc4_hdmi_read/write()
2020-09-10 10:07 ` Dan Carpenter
@ 2020-09-10 10:19 ` Maxime Ripard
-1 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2020-09-10 10:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dave Stevenson, David Airlie, kernel-janitors, dri-devel,
Eric Anholt
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On Thu, Sep 10, 2020 at 01:07:48PM +0300, Dan Carpenter wrote:
> The variant->registers[] has ->num_registers elements so the >
> comparison needs to be changes to >= to prevent an out of bounds
> access.
>
> Fixes: 311e305fdb4e ("drm/vc4: hdmi: Implement a register layout abstraction")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks!
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/vc4: hdmi: Fix off by ones in vc4_hdmi_read/write()
@ 2020-09-10 10:19 ` Maxime Ripard
0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2020-09-10 10:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dave Stevenson, David Airlie, kernel-janitors, dri-devel,
Eric Anholt
[-- Attachment #1.1: Type: text/plain, Size: 382 bytes --]
On Thu, Sep 10, 2020 at 01:07:48PM +0300, Dan Carpenter wrote:
> The variant->registers[] has ->num_registers elements so the >
> comparison needs to be changes to >= to prevent an out of bounds
> access.
>
> Fixes: 311e305fdb4e ("drm/vc4: hdmi: Implement a register layout abstraction")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks!
Maxime
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-11 9:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-10 10:07 [PATCH] drm/vc4: hdmi: Fix off by ones in vc4_hdmi_read/write() Dan Carpenter
2020-09-10 10:07 ` Dan Carpenter
2020-09-10 10:19 ` Maxime Ripard
2020-09-10 10:19 ` Maxime Ripard
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.