提交 04feb58d 编写于 作者: H Hans Verkuil 提交者: Greg Kroah-Hartman

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: 3e14e7a8 ("vivid-tpg: add hor/vert downsampling support to tpg_gen_text")
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Reported-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: <stable@vger.kernel.org>      # for v4.1 and up
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 90bedf4a
...@@ -1770,7 +1770,7 @@ typedef struct { u16 __; u8 _; } __packed x24; ...@@ -1770,7 +1770,7 @@ typedef struct { u16 __; u8 _; } __packed x24;
pos[7] = (chr & (0x01 << 0) ? fg : bg); \ pos[7] = (chr & (0x01 << 0) ? fg : bg); \
} \ } \
\ \
pos += (tpg->hflip ? -8 : 8) / hdiv; \ pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \
} \ } \
} \ } \
} while (0) } while (0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册