video/hdmi: Fix AVI bar unpack
diff mbox series

Message ID 20190919132853.30954-1-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • video/hdmi: Fix AVI bar unpack
Related show

Commit Message

Ville Syrjälä Sept. 19, 2019, 1:28 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The bar values are little endian, not big endian. The pack
function did it right but the unpack got it wrong. Fix it.

Cc: stable@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: Martin Bugge <marbugge@cisco.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Fixes: 2c676f378edb ("[media] hdmi: added unpack and logging functions for InfoFrames")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/video/hdmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thierry Reding Sept. 20, 2019, 2:58 p.m. UTC | #1
On Thu, Sep 19, 2019 at 04:28:53PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The bar values are little endian, not big endian. The pack
> function did it right but the unpack got it wrong. Fix it.
> 
> Cc: stable@vger.kernel.org
> Cc: linux-media@vger.kernel.org
> Cc: Martin Bugge <marbugge@cisco.com>
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Thierry Reding <treding@nvidia.com>
> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Fixes: 2c676f378edb ("[media] hdmi: added unpack and logging functions for InfoFrames")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/video/hdmi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Ville Syrjälä Sept. 20, 2019, 4:06 p.m. UTC | #2
On Fri, Sep 20, 2019 at 04:58:53PM +0200, Thierry Reding wrote:
> On Thu, Sep 19, 2019 at 04:28:53PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > The bar values are little endian, not big endian. The pack
> > function did it right but the unpack got it wrong. Fix it.
> > 
> > Cc: stable@vger.kernel.org
> > Cc: linux-media@vger.kernel.org
> > Cc: Martin Bugge <marbugge@cisco.com>
> > Cc: Hans Verkuil <hans.verkuil@cisco.com>
> > Cc: Thierry Reding <treding@nvidia.com>
> > Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > Fixes: 2c676f378edb ("[media] hdmi: added unpack and logging functions for InfoFrames")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/video/hdmi.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Reviewed-by: Thierry Reding <treding@nvidia.com>

Thanks. Pushed to drm-misc-next.

Patch
diff mbox series

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index b939bc28d886..9c82e2a0a411 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -1576,12 +1576,12 @@  static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame,
 	if (ptr[0] & 0x10)
 		frame->active_aspect = ptr[1] & 0xf;
 	if (ptr[0] & 0x8) {
-		frame->top_bar = (ptr[5] << 8) + ptr[6];
-		frame->bottom_bar = (ptr[7] << 8) + ptr[8];
+		frame->top_bar = (ptr[6] << 8) | ptr[5];
+		frame->bottom_bar = (ptr[8] << 8) | ptr[7];
 	}
 	if (ptr[0] & 0x4) {
-		frame->left_bar = (ptr[9] << 8) + ptr[10];
-		frame->right_bar = (ptr[11] << 8) + ptr[12];
+		frame->left_bar = (ptr[10] << 8) | ptr[9];
+		frame->right_bar = (ptr[12] << 8) | ptr[11];
 	}
 	frame->scan_mode = ptr[0] & 0x3;