lkml.org 
[lkml]   [2018]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 022/328] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
    3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Sylwester Nawrocki <s.nawrocki@samsung.com>

    commit 7c1b9a5aeed91bef98988ac0fcf38c8c1f4f9a3a upstream.

    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: 34947b8aebe3: ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver")

    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/media/platform/exynos4-is/fimc-isp-video.c | 11 ++++++++---
    1 file changed, 8 insertions(+), 3 deletions(-)

    --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
    +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
    @@ -390,12 +390,17 @@ static void __isp_video_try_fmt(struct f
    struct v4l2_pix_format_mplane *pixm,
    const struct fimc_fmt **fmt)
    {
    - *fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
    + const struct fimc_fmt *__fmt;
    +
    + __fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
    +
    + if (fmt)
    + *fmt = __fmt;

    pixm->colorspace = V4L2_COLORSPACE_SRGB;
    pixm->field = V4L2_FIELD_NONE;
    - pixm->num_planes = (*fmt)->memplanes;
    - pixm->pixelformat = (*fmt)->fourcc;
    + pixm->num_planes = __fmt->memplanes;
    + pixm->pixelformat = __fmt->fourcc;
    /*
    * TODO: double check with the docmentation these width/height
    * constraints are correct.
    \
     
     \ /
      Last update: 2018-12-09 23:27    [W:4.122 / U:0.488 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site