]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
authorKarina Yankevich <k.yankevich@omp.ru>
Wed, 21 Aug 2024 11:31:34 +0000 (14:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:39:14 +0000 (07:39 +0200)
commit00b363790baac823b4bbc3614ff17a2f796e6dda
treee2b3b7f42ad3c21eaaaf38749685961a9fcaf09b
parent30b46f95f8192f77fbf0dc57aac4e8fbfc0a2e58
media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()

commit 3edd1fc48d2c045e8259561797c89fe78f01717e upstream.

In v4l2_detect_gtf(), it seems safer to cast the 32-bit image_width
variable to the 64-bit type u64 before multiplying to avoid
a possible overflow. The resulting object code even seems to
look better, at least on x86_64.

Found by Linux Verification Center (linuxtesting.org) with Svace.

[Sergey: rewrote the patch subject/descripition]

Fixes: c9bc9f50753d ("[media] v4l2-dv-timings: fix overflow in gtf timings calculation")
Cc: stable@vger.kernel.org
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-dv-timings.c