]> git.hungrycats.org Git - linux/commit
media: s5p-jpeg: prevent buffer overflows
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 15 Oct 2024 09:10:31 +0000 (11:10 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 18 Oct 2024 08:43:03 +0000 (10:43 +0200)
commit14a22762c3daeac59a5a534e124acbb4d7a79b3a
tree671c52f257f9a406f663bb0dc27679f562da4d07
parent458ea1c0be991573ec436aa0afa23baacfae101a
media: s5p-jpeg: prevent buffer overflows

The current logic allows word to be less than 2. If this happens,
there will be buffer overflows, as reported by smatch. Add extra
checks to prevent it.

While here, remove an unused word = 0 assignment.

Fixes: 6c96dbbc2aa9 ("[media] s5p-jpeg: add support for 5433")
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c