linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: [media] exynos4-is: Add the FIMC-IS ISP capture DMA driver
@ 2014-05-08 13:16 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-05-08 13:16 UTC (permalink / raw)
  To: s.nawrocki; +Cc: linux-media, linux-samsung-soc

Hello Sylwester Nawrocki,

The patch 34947b8aebe3: "[media] exynos4-is: Add the FIMC-IS ISP
capture DMA driver" from Dec 20, 2013, leads to the following static
checker warning:

	drivers/media/platform/exynos4-is/fimc-isp-video.c:415 isp_video_try_fmt_mplane()
	error: XXX NULL dereference inside function. '()' '0'

drivers/media/platform/exynos4-is/fimc-isp-video.c
   390  static void __isp_video_try_fmt(struct fimc_isp *isp,
   391                                  struct v4l2_pix_format_mplane *pixm,
   392                                  const struct fimc_fmt **fmt)
   393  {
   394          *fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
   395  
   396          pixm->colorspace = V4L2_COLORSPACE_SRGB;
   397          pixm->field = V4L2_FIELD_NONE;
   398          pixm->num_planes = (*fmt)->memplanes;
   399          pixm->pixelformat = (*fmt)->fourcc;
   400          /*
   401           * TODO: double check with the docmentation these width/height
   402           * constraints are correct.
   403           */
   404          v4l_bound_align_image(&pixm->width, FIMC_ISP_SOURCE_WIDTH_MIN,
   405                                FIMC_ISP_SOURCE_WIDTH_MAX, 3,
   406                                &pixm->height, FIMC_ISP_SOURCE_HEIGHT_MIN,
   407                                FIMC_ISP_SOURCE_HEIGHT_MAX, 0, 0);
   408  }
   409  
   410  static int isp_video_try_fmt_mplane(struct file *file, void *fh,
   411                                          struct v4l2_format *f)
   412  {
   413          struct fimc_isp *isp = video_drvdata(file);
   414  
   415          __isp_video_try_fmt(isp, &f->fmt.pix_mp, NULL);
                                                         ^^^^
This will just NULL deref.  What was intended?

   416          return 0;
   417  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: [media] exynos4-is: Add the FIMC-IS ISP capture DMA driver
@ 2014-10-02 12:16 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-10-02 12:16 UTC (permalink / raw)
  To: s.nawrocki; +Cc: linux-media, linux-samsung-soc

Hello Sylwester Nawrocki,

The patch 34947b8aebe3: "[media] exynos4-is: Add the FIMC-IS ISP
capture DMA driver" from Dec 20, 2013, leads to the following static
checker warning:

	drivers/media/platform/exynos4-is/fimc-isp-video.c:413 isp_video_try_fmt_mplane()
	error: NULL dereference inside function.

drivers/media/platform/exynos4-is/fimc-isp-video.c
   388  static void __isp_video_try_fmt(struct fimc_isp *isp,
   389                                  struct v4l2_pix_format_mplane *pixm,
   390                                  const struct fimc_fmt **fmt)
   391  {
   392          *fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);

"fmt" isn't allowed to be NULL.

   393  
   394          pixm->colorspace = V4L2_COLORSPACE_SRGB;
   395          pixm->field = V4L2_FIELD_NONE;
   396          pixm->num_planes = (*fmt)->memplanes;
   397          pixm->pixelformat = (*fmt)->fourcc;
   398          /*
   399           * TODO: double check with the docmentation these width/height
   400           * constraints are correct.
   401           */
   402          v4l_bound_align_image(&pixm->width, FIMC_ISP_SOURCE_WIDTH_MIN,
   403                                FIMC_ISP_SOURCE_WIDTH_MAX, 3,
   404                                &pixm->height, FIMC_ISP_SOURCE_HEIGHT_MIN,
   405                                FIMC_ISP_SOURCE_HEIGHT_MAX, 0, 0);
   406  }
   407  
   408  static int isp_video_try_fmt_mplane(struct file *file, void *fh,
   409                                          struct v4l2_format *f)
   410  {
   411          struct fimc_isp *isp = video_drvdata(file);
   412  
   413          __isp_video_try_fmt(isp, &f->fmt.pix_mp, NULL);
                                                         ^^^^
NULL dereference here.

   414          return 0;
   415  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-02 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 13:16 [media] exynos4-is: Add the FIMC-IS ISP capture DMA driver Dan Carpenter
2014-10-02 12:16 Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).