mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
media: v4l2-tpg: Clamp hue in tpg_s_hue()
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-cisco@xs4all.nl> Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
e3158a5e7e
commit
45c2044ccb
1 changed files with 1 additions and 0 deletions
|
@ -325,6 +325,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;
|
||||
|
|
Loading…
Reference in a new issue