summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2018-10-08 15:08:27 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-13 11:08:52 -0800
commit04feb58d811be27c92745442497ea5c96999f38f (patch)
treede8fdd214833bd5865a7a1ce35302b3a49eaa60a /drivers
parent90bedf4a7c76ad7fcb002c1ecd1246a34c299af9 (diff)
downloadlinux-stable-04feb58d811be27c92745442497ea5c96999f38f.tar.gz
linux-stable-04feb58d811be27c92745442497ea5c96999f38f.tar.bz2
linux-stable-04feb58d811be27c92745442497ea5c96999f38f.zip
media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD
commit 250854eed5d45a73d81e4137dfd85180af6f2ec3 upstream. When the OSD is on (i.e. vivid displays text on top of the test pattern), and you enable hflip, then the driver crashes. The cause turned out to be a division of a negative number by an unsigned value. You expect that -8 / 2U would be -4, but in reality it is 2147483644 :-( Fixes: 3e14e7a82c1ef ("vivid-tpg: add hor/vert downsampling support to tpg_gen_text") Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Cc: <stable@vger.kernel.org> # for v4.1 and up Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/v4l2-tpg/v4l2-tpg-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index abd4c788dffd..f40ab5704bf0 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -1770,7 +1770,7 @@ typedef struct { u16 __; u8 _; } __packed x24;
pos[7] = (chr & (0x01 << 0) ? fg : bg); \
} \
\
- pos += (tpg->hflip ? -8 : 8) / hdiv; \
+ pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \
} \
} \
} while (0)