media: imx-jpeg: Fix potential array out of bounds in queue_setup
Fix smatch warning in mxc_jpeg_queue_setup, check *nplanes against current format: drivers/media/platform/imx-jpeg/mxc-jpeg.c:1070 mxc_jpeg_queue_setup() warn: potential user controlled iterator 'i' (array size 2 vs 7) Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
ae309657b0
commit
e490fa1be5
@ -1081,6 +1081,8 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q,
|
|||||||
|
|
||||||
/* Handle CREATE_BUFS situation - *nplanes != 0 */
|
/* Handle CREATE_BUFS situation - *nplanes != 0 */
|
||||||
if (*nplanes) {
|
if (*nplanes) {
|
||||||
|
if (*nplanes != q_data->fmt->colplanes)
|
||||||
|
return -EINVAL;
|
||||||
for (i = 0; i < *nplanes; i++) {
|
for (i = 0; i < *nplanes; i++) {
|
||||||
if (sizes[i] < q_data->sizeimage[i])
|
if (sizes[i] < q_data->sizeimage[i])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user