diff options
author | Tsuchiya Yuto <kitakar@gmail.com> | 2021-12-01 17:19:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 13:04:36 +0300 |
commit | 6aaff2d7c9d52ae523ca318639c7dc74e751dc88 (patch) | |
tree | 7571fb08873e46f1d1dabfe1740b038c63b89bf8 /drivers/staging/media/atomisp/pci/atomisp_ioctl.c | |
parent | a2e962b2d8b072f965abbd3b2f37984f0e7b2714 (diff) | |
download | linux-6aaff2d7c9d52ae523ca318639c7dc74e751dc88.tar.xz |
media: atomisp: fix "variable dereferenced before check 'asd'"
[ Upstream commit ac56760a8bbb4e654b2fd54e5de79dd5d72f937d ]
There are two occurrences where the variable 'asd' is dereferenced
before check. Fix this issue by using the variable after the check.
Link: https://lore.kernel.org/linux-media/20211122074122.GA6581@kili/
Link: https://lore.kernel.org/linux-media/20211201141904.47231-1-kitakar@gmail.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/staging/media/atomisp/pci/atomisp_ioctl.c')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 54624f8814e0..b7dda4b96d49 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1123,7 +1123,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, struct ia_css_frame *frame; struct videobuf_vmalloc_memory *vm_mem; u16 source_pad = atomisp_subdev_source_pad(vdev); - u16 stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); + u16 stream_id; int ret = 0, i = 0; if (!asd) { @@ -1131,6 +1131,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, __func__, vdev->name); return -EINVAL; } + stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); if (req->count == 0) { mutex_lock(&pipe->capq.vb_lock); |