From patchwork Mon Nov 20 13:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10066501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A3F2F602B7 for ; Mon, 20 Nov 2017 13:41:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96862290D6 for ; Mon, 20 Nov 2017 13:41:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B84E2913A; Mon, 20 Nov 2017 13:41:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5582F289D6 for ; Mon, 20 Nov 2017 13:41:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B63C6E18C; Mon, 20 Nov 2017 13:41:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb1-smtp-cloud9.xs4all.net (lb1-smtp-cloud9.xs4all.net [194.109.24.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4EE3C6E162 for ; Mon, 20 Nov 2017 13:41:35 +0000 (UTC) Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud9.xs4all.net with ESMTPA id GmKHe1Bj5nIXbGmKLeOPPF; Mon, 20 Nov 2017 14:41:33 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 1/2] drivers/video/hdmi: allow for larger-than-needed vendor IF Date: Mon, 20 Nov 2017 14:41:28 +0100 Message-Id: <20171120134129.26161-2-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171120134129.26161-1-hverkuil@xs4all.nl> References: <20171120134129.26161-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfCuRUrAlKYNUjhgLsU3Jlxtn4uul9ff2hBaV0CXB8eHtoOZk2J+ErZtf2xSXIETe/iRDqGPcXy80krc9WNm1YiiPqfIrQ/P88knQIHQff1N740Yo7T3M zBODTH5urcJyb/clZFaCBkT9UcveCgsosDER4bab8ukrBGkjLo5OX5Bl3hT4R+Wbre2g9dVQSsB0Kyzj6PiPAiMW0dNOOlFMmRfoHu2HFtAlViIBPkVeNheU rICPy6CRvtNHF639vJDCmQmRBytnpQhDtIFvzCVy6FtmEzIyVFp1caPnBIxfdJ7ahSTrz9zdIVnKBPFW3gCkqg== Cc: Hans Verkuil , Daniel Vetter , Thierry Reding , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Some devices (Windows Intel driver!) send a Vendor InfoFrame that uses a payload length of 0x1b instead of the length of 5 or 6 that the unpack code expects. The InfoFrame is padded with 0 by the source. The current code thinks anything other than 5 or 6 is an error, but larger values are allowed by the specification. So support that here as well. Signed-off-by: Hans Verkuil --- drivers/video/hdmi.c | 3 +-- include/linux/hdmi.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index 1cf907ecded4..61f803f75a47 100644 --- a/drivers/video/hdmi.c +++ b/drivers/video/hdmi.c @@ -1164,8 +1164,7 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, struct hdmi_vendor_infoframe *hvf = &frame->hdmi; if (ptr[0] != HDMI_INFOFRAME_TYPE_VENDOR || - ptr[1] != 1 || - (ptr[2] != 5 && ptr[2] != 6)) + ptr[1] != 1 || ptr[2] < 5 || ptr[2] > HDMI_VENDOR_INFOFRAME_SIZE) return -EINVAL; length = ptr[2]; diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index d271ff23984f..14d3531a0eda 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -40,6 +40,7 @@ enum hdmi_infoframe_type { #define HDMI_AVI_INFOFRAME_SIZE 13 #define HDMI_SPD_INFOFRAME_SIZE 25 #define HDMI_AUDIO_INFOFRAME_SIZE 10 +#define HDMI_VENDOR_INFOFRAME_SIZE 31 #define HDMI_INFOFRAME_SIZE(type) \ (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)