diff options
| author | Dan Carpenter <[email protected]> | 2020-12-09 07:50:34 +0100 |
|---|---|---|
| committer | Mauro Carvalho Chehab <[email protected]> | 2021-01-12 18:14:48 +0100 |
| commit | b00481bdca2d77fdae5f71517c09fd3b30eba57d (patch) | |
| tree | 3f7149fec190eab7c60b2ac768096db5aa9e8e6e | |
| parent | a819678d0dcc3cec41a5fd6d359ce5e86f5c58be (diff) | |
media: camss: Fix signedness bug in video_enum_fmt()
This test has a problem because we want to know if "k" is -1 or a
positive value less than "f->index". But the "f->index" variable is a
u32 so if "k == -1" then -1 gets type promoted to UINT_MAX which is
larger than "f->index". I've added an explicit test to check for -1.
Fixes: a3d412d4b9f3 ("media: Revert "media: camss: Make use of V4L2_CAP_IO_MC"")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Robert Foss <[email protected]>
Reviewed-by: Andrey Konovalov <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
| -rw-r--r-- | drivers/media/platform/qcom/camss/camss-video.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index bd9334af1c73..2fa3214775d5 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -579,7 +579,7 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) break; } - if (k < f->index) + if (k == -1 || k < f->index) /* * All the unique pixel formats matching the arguments * have been enumerated (k >= 0 and f->index > 0), or |