Skip to content

Commit

Permalink
video/hmdi: Clear the whole incoming buffer, not just the infoframe size
Browse files Browse the repository at this point in the history
If the user if this API is providing a bigger buffer than the infoframe
size, it could be for a could reason. For instance it could be because
it gives the buffer that will be written to the hardware, up to the
maximum of an infoframe size.

Instead of just zeroing up to the infoframe size, let's zero the whole
incoming buffer as those extra bytes are also used to compute the
ECC and need to be 0.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Damien Lespiau authored and Daniel Vetter committed Aug 8, 2013
1 parent 61177b0 commit 3b390f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/video/hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
if (size < length)
return -ENOSPC;

memset(buffer, 0, length);
memset(buffer, 0, size);

ptr[0] = frame->type;
ptr[1] = frame->version;
Expand Down Expand Up @@ -186,7 +186,7 @@ ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer,
if (size < length)
return -ENOSPC;

memset(buffer, 0, length);
memset(buffer, 0, size);

ptr[0] = frame->type;
ptr[1] = frame->version;
Expand Down Expand Up @@ -251,7 +251,7 @@ ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
if (size < length)
return -ENOSPC;

memset(buffer, 0, length);
memset(buffer, 0, size);

if (frame->channels >= 2)
channels = frame->channels - 1;
Expand Down Expand Up @@ -308,7 +308,7 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
if (size < length)
return -ENOSPC;

memset(buffer, 0, length);
memset(buffer, 0, size);

ptr[0] = frame->type;
ptr[1] = frame->version;
Expand Down

0 comments on commit 3b390f6

Please sign in to comment.