From: "Ville Syrjälä" <ville.syrjala@linux.intel.com> To: Hans Verkuil <hverkuil@xs4all.nl> Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Thierry Reding <thierry.reding@gmail.com>, Hans Verkuil <hans.verkuil@cisco.com>, linux-media@vger.kernel.org Subject: Re: [PATCH 10/10] video/hdmi: Pass buffer size to infoframe unpack functions Date: Mon, 20 Nov 2017 16:55:57 +0200 [thread overview] Message-ID: <20171120145557.GX10981@intel.com> (raw) In-Reply-To: <7722c9f6-4bad-7698-da5d-41fe50974562@xs4all.nl> On Mon, Nov 20, 2017 at 02:36:20PM +0100, Hans Verkuil wrote: > On 11/13/2017 06:04 PM, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> <snip> > > @@ -1163,7 +1176,7 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, > > */ > > static int > > hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > - const void *buffer) > > + const void *buffer, size_t size) > > { > > const u8 *ptr = buffer; > > size_t length; > > @@ -1171,6 +1184,9 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > u8 hdmi_video_format; > > struct hdmi_vendor_infoframe *hvf = &frame->hdmi; > > > > + if (size < HDMI_INFOFRAME_HEADER_SIZE) > > + return -EINVAL; > > + > > This check is not needed since that is already done in hdmi_infoframe_unpack(). Hmm. True. Somehow I was expecting that this function would have been exported on its own, but it's static so clearly I was mistaken. The pack functions are individually exported, which is where I got this idea probably. > > > if (ptr[0] != HDMI_INFOFRAME_TYPE_VENDOR || > > ptr[1] != 1 || > > (ptr[2] != 4 && ptr[2] != 5 && ptr[2] != 6)) > > @@ -1178,6 +1194,9 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > > > length = ptr[2]; > > > > + if (size < HDMI_INFOFRAME_HEADER_SIZE + length) > > + return -EINVAL; > > + > > if (hdmi_infoframe_checksum(buffer, > > HDMI_INFOFRAME_HEADER_SIZE + length) != 0) > > return -EINVAL; -- Ville Syrjälä Intel OTC
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com> To: Hans Verkuil <hverkuil@xs4all.nl> Cc: intel-gfx@lists.freedesktop.org, Thierry Reding <thierry.reding@gmail.com>, Hans Verkuil <hans.verkuil@cisco.com>, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Subject: Re: [PATCH 10/10] video/hdmi: Pass buffer size to infoframe unpack functions Date: Mon, 20 Nov 2017 16:55:57 +0200 [thread overview] Message-ID: <20171120145557.GX10981@intel.com> (raw) In-Reply-To: <7722c9f6-4bad-7698-da5d-41fe50974562@xs4all.nl> On Mon, Nov 20, 2017 at 02:36:20PM +0100, Hans Verkuil wrote: > On 11/13/2017 06:04 PM, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> <snip> > > @@ -1163,7 +1176,7 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, > > */ > > static int > > hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > - const void *buffer) > > + const void *buffer, size_t size) > > { > > const u8 *ptr = buffer; > > size_t length; > > @@ -1171,6 +1184,9 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > u8 hdmi_video_format; > > struct hdmi_vendor_infoframe *hvf = &frame->hdmi; > > > > + if (size < HDMI_INFOFRAME_HEADER_SIZE) > > + return -EINVAL; > > + > > This check is not needed since that is already done in hdmi_infoframe_unpack(). Hmm. True. Somehow I was expecting that this function would have been exported on its own, but it's static so clearly I was mistaken. The pack functions are individually exported, which is where I got this idea probably. > > > if (ptr[0] != HDMI_INFOFRAME_TYPE_VENDOR || > > ptr[1] != 1 || > > (ptr[2] != 4 && ptr[2] != 5 && ptr[2] != 6)) > > @@ -1178,6 +1194,9 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, > > > > length = ptr[2]; > > > > + if (size < HDMI_INFOFRAME_HEADER_SIZE + length) > > + return -EINVAL; > > + > > if (hdmi_infoframe_checksum(buffer, > > HDMI_INFOFRAME_HEADER_SIZE + length) != 0) > > return -EINVAL; -- Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-11-20 14:56 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-13 17:04 [PATCH 00/10] drm/edid: Infoframe cleanups and fixes Ville Syrjala 2017-11-13 17:04 ` [PATCH 01/10] video/hdmi: Allow "empty" HDMI infoframes Ville Syrjala 2017-11-13 17:04 ` Ville Syrjala 2017-11-16 14:36 ` Sharma, Shashank 2017-11-16 16:16 ` Ville Syrjälä 2017-11-17 3:05 ` Sharma, Shashank 2017-11-17 3:05 ` Sharma, Shashank 2017-11-13 17:04 ` [PATCH 02/10] drm/edid: Allow HDMI infoframe without VIC or S3D Ville Syrjala 2017-11-16 14:40 ` Sharma, Shashank 2017-11-16 16:21 ` Ville Syrjälä 2017-11-17 3:10 ` Sharma, Shashank 2017-11-22 18:28 ` Ville Syrjälä 2017-11-13 17:04 ` [PATCH 03/10] drm/modes: Introduce drm_mode_match() Ville Syrjala 2017-11-13 17:04 ` [PATCH 04/10] drm/edid: Use drm_mode_match_no_clocks_no_stereo() for consistentcy Ville Syrjala 2017-11-13 17:04 ` [PATCH 05/10] drm/edid: Fix up edid_cea_modes[] formatting Ville Syrjala 2017-11-13 17:04 ` [PATCH 06/10] drm/edid: Fix cea mode aspect ratio handling Ville Syrjala 2017-11-13 18:13 ` Jose Abreu 2017-11-13 18:53 ` Ville Syrjälä 2017-11-16 14:51 ` Sharma, Shashank 2017-11-16 16:23 ` Ville Syrjälä 2017-11-17 3:19 ` Sharma, Shashank 2017-11-17 11:35 ` Ville Syrjälä 2017-11-17 12:20 ` Sharma, Shashank 2017-11-17 12:49 ` Ville Syrjälä 2017-11-24 8:56 ` Sharma, Shashank 2017-11-24 13:22 ` Ville Syrjälä 2017-11-13 17:04 ` [PATCH 07/10] drm/edid: Don't send bogus aspect ratios in AVI infoframes Ville Syrjala 2017-11-13 18:30 ` Jose Abreu 2017-11-13 19:00 ` Ville Syrjälä 2017-11-16 15:01 ` Sharma, Shashank 2017-11-16 16:26 ` Ville Syrjälä 2017-11-17 3:23 ` Sharma, Shashank 2017-11-17 11:38 ` Ville Syrjälä 2017-11-24 8:55 ` Sharma, Shashank 2017-11-13 17:04 ` [PATCH 08/10] video/hdmi: Reject illegal picture aspect ratios Ville Syrjala 2017-11-13 18:33 ` Jose Abreu 2017-11-13 18:33 ` Jose Abreu 2017-11-13 17:04 ` [PATCH 09/10] video/hdmi: Constify 'buffer' to the unpack functions Ville Syrjala 2017-11-13 17:04 ` [PATCH 10/10] video/hdmi: Pass buffer size to infoframe " Ville Syrjala 2017-11-20 13:36 ` Hans Verkuil 2017-11-20 14:55 ` Ville Syrjälä [this message] 2017-11-20 14:55 ` Ville Syrjälä 2017-11-13 17:52 ` ✓ Fi.CI.BAT: success for drm/edid: Infoframe cleanups and fixes Patchwork 2017-11-13 19:07 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20171120145557.GX10981@intel.com \ --to=ville.syrjala@linux.intel.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=hans.verkuil@cisco.com \ --cc=hverkuil@xs4all.nl \ --cc=intel-gfx@lists.freedesktop.org \ --cc=linux-media@vger.kernel.org \ --cc=thierry.reding@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.