* [Linux-kernel-mentees] [PATCH] v4l2-tpg: Clamp hue in tpg_s_hue()
@ 2020-08-21 15:13 Peilin Ye
0 siblings, 0 replies; only message in thread
From: Peilin Ye @ 2020-08-21 15:13 UTC (permalink / raw)
To: Hans Verkuil, Mauro Carvalho Chehab
Cc: Peilin Ye, Greg Kroah-Hartman, linux-media, linux-kernel-mentees,
syzkaller-bugs, linux-kernel
Setting `hue` by calling tpg_s_hue() directly is risky, since it does not
perform range check. Clamp `hue` to the valid range in tpg_s_hue().
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
---
include/media/tpg/v4l2-tpg.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h
index eb191e85d363..fd15e5db9f5b 100644
--- a/include/media/tpg/v4l2-tpg.h
+++ b/include/media/tpg/v4l2-tpg.h
@@ -324,6 +324,7 @@ static inline void tpg_s_saturation(struct tpg_data *tpg,
static inline void tpg_s_hue(struct tpg_data *tpg,
s16 hue)
{
+ hue = clamp_t(s16, hue, -128, 128);
if (tpg->hue == hue)
return;
tpg->hue = hue;
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-21 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 15:13 [Linux-kernel-mentees] [PATCH] v4l2-tpg: Clamp hue in tpg_s_hue() Peilin Ye
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).