All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: linux-media@vger.kernel.org
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	kernel@collabora.com, laurent.pinchart@ideasonboard.com,
	hverkuil@xs4all.nl, dafna3@gmail.com,
	sakari.ailus@linux.intel.com, mchehab@kernel.org
Subject: [PATCH v2 0/2] media: videobuf2: make sure bytesused is smaller than the buffer size
Date: Thu, 11 Nov 2021 17:26:38 +0200	[thread overview]
Message-ID: <20211111152640.1537-1-dafna.hirschfeld@collabora.com> (raw)

Add a WARN_ON_ONCE in vb2_set_plane_payload if bytesused is bigger than length
and clamp the bytesused to lenth.
Also change places where bytesused is set directly with that function.
This help find/eliminate possible buffer overflow.

chnages since v2:
* replace WARN_ON with WARN_ON_ONCE
* clamp the bytesused to the buffer length if it is bigger
* add inline doc

Dafna Hirschfeld (2):
  media: replace setting of bytesused with vb2_set_plane_payload
  media: videobuf2: add WARN_ON if bytesused is bigger than buffer
    length

 drivers/media/platform/allegro-dvt/allegro-core.c  |  2 +-
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 10 +++++-----
 drivers/media/test-drivers/vicodec/vicodec-core.c  |  2 +-
 drivers/media/usb/go7007/go7007-driver.c           |  2 +-
 drivers/staging/media/meson/vdec/vdec_helpers.c    | 10 +++++-----
 include/media/videobuf2-core.h                     |  8 +++++++-
 6 files changed, 20 insertions(+), 14 deletions(-)

-- 
2.17.1


             reply	other threads:[~2021-11-11 15:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 15:26 Dafna Hirschfeld [this message]
2021-11-11 15:26 ` [PATCH v2 1/2] media: replace setting of bytesused with vb2_set_plane_payload Dafna Hirschfeld
2021-11-16  2:24   ` kernel test robot
2021-11-16  2:24     ` kernel test robot
2021-11-11 15:26 ` [PATCH v2 2/2] media: videobuf2: add WARN_ON if bytesused is bigger than buffer length Dafna Hirschfeld
2021-11-12  0:10   ` Laurent Pinchart
2021-11-24 15:47   ` Hans Verkuil

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=20211111152640.1537-1-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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: link
Be 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.