Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion drivers/gpu/drm/vc4/vc4_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static int vc4_hdmi_write_infoframe(struct drm_connector *connector,
if (!drm_dev_enter(drm, &idx))
return 0;

if (len > sizeof(buffer)) {
if (len > VC4_HDMI_PACKET_SIZE) {
ret = -ENOMEM;
goto out;
}
Expand All @@ -680,6 +680,9 @@ static int vc4_hdmi_write_infoframe(struct drm_connector *connector,
base + packet_reg);
packet_reg += 4;

if (packet_reg >= packet_reg_next)
break;

writel(buffer[i + 3] << 0 |
buffer[i + 4] << 8 |
buffer[i + 5] << 16 |
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/vc4/vc4_hdmi_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

#define VC4_HDMI_PACKET_STRIDE 0x24

/*
* A packet RAM slot is 9 words, holding a 3-byte packet header followed by
* four 7-byte subpackets, so only 31 of its 36 bytes are addressable.
*/
#define VC4_HDMI_PACKET_SIZE 31

enum vc4_hdmi_regs {
VC4_INVALID = 0,
VC4_HDMI,
Expand Down
Loading