All of lore.kernel.org
 help / color / mirror / Atom feed
* [git:media_tree/fixes] media: vicodec: fix memchr() kernel oops
@ 2018-11-20 17:53 Mauro Carvalho Chehab
  0 siblings, 0 replies; only message in thread
From: Mauro Carvalho Chehab @ 2018-11-20 17:53 UTC (permalink / raw)
  To: linuxtv-commits; +Cc: Hans Verkuil, stable

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: vicodec: fix memchr() kernel oops
Author:  Hans Verkuil <hverkuil@xs4all.nl>
Date:    Sat Nov 17 06:25:08 2018 -0500

The size passed to memchr is too large as it assumes the search
starts at the start of the buffer, but it can start at an offset.

Cc: <stable@vger.kernel.org>      # for v4.19 and up
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

 drivers/media/platform/vicodec/vicodec-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
index b292cff26c86..013cdebecbc4 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -304,7 +304,8 @@ restart:
 		for (; p < p_out + sz; p++) {
 			u32 copy;
 
-			p = memchr(p, magic[ctx->comp_magic_cnt], sz);
+			p = memchr(p, magic[ctx->comp_magic_cnt],
+				   p_out + sz - p);
 			if (!p) {
 				ctx->comp_magic_cnt = 0;
 				break;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-21  4:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20 17:53 [git:media_tree/fixes] media: vicodec: fix memchr() kernel oops Mauro Carvalho Chehab

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.