Skip to content

Commit 7c1b9a5

Browse files
Sylwester Nawrockimchehab
authored andcommitted
media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
This patch fixes potential NULL pointer dereference as indicated by the following static checker warning: drivers/media/platform/exynos4-is/fimc-isp-video.c:408 isp_video_try_fmt_mplane() error: NULL dereference inside function '__isp_video_try_fmt(isp, &f->fmt.pix_mp, (0))()'. Fixes: 34947b8: ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Sylwester Nawrocki <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 666e994 commit 7c1b9a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/media/platform/exynos4-is/fimc-isp-video.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,17 @@ static void __isp_video_try_fmt(struct fimc_isp *isp,
384384
struct v4l2_pix_format_mplane *pixm,
385385
const struct fimc_fmt **fmt)
386386
{
387-
*fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
387+
const struct fimc_fmt *__fmt;
388+
389+
__fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
390+
391+
if (fmt)
392+
*fmt = __fmt;
388393

389394
pixm->colorspace = V4L2_COLORSPACE_SRGB;
390395
pixm->field = V4L2_FIELD_NONE;
391-
pixm->num_planes = (*fmt)->memplanes;
392-
pixm->pixelformat = (*fmt)->fourcc;
396+
pixm->num_planes = __fmt->memplanes;
397+
pixm->pixelformat = __fmt->fourcc;
393398
/*
394399
* TODO: double check with the docmentation these width/height
395400
* constraints are correct.

0 commit comments

Comments
 (0)