Skip to content

Commit a2bffd9

Browse files
mchehabgregkh
authored andcommitted
atomisp: don't let it go past pipes array
[ Upstream commit 1f6c45a ] In practice, IA_CSS_PIPE_ID_NUM should never be used when calling atomisp_q_video_buffers_to_css(), as the driver should discover the right pipe before calling it. Yet, if some pipe parsing issue happens, it could end using it. So, add a WARN_ON() to prevent such case. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e14cc65 commit a2bffd9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/staging/media/atomisp/pci/atomisp_fops.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ int atomisp_q_video_buffers_to_css(struct atomisp_sub_device *asd,
221221
unsigned long irqflags;
222222
int err = 0;
223223

224+
if (WARN_ON(css_pipe_id >= IA_CSS_PIPE_ID_NUM))
225+
return -EINVAL;
226+
224227
while (pipe->buffers_in_css < ATOMISP_CSS_Q_DEPTH) {
225228
struct videobuf_buffer *vb;
226229

0 commit comments

Comments
 (0)