:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: 
drivers/media/platform/nxp/imx-pxp.c:1189:18: warning: dereference of NULL 
'fmt' [CWE-476] [-Wanalyzer-null-dereference]"
:::::: 

CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Mauro Carvalho Chehab <[email protected]>
CC: [email protected]
CC: Laurent Pinchart <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   30306f6194cadcc29c77f6ddcd416a75bf5c0232
commit: 46fb99951fe2c71adfd7f4ea4439af5ed5ebb7f7 media: platform: place NXP 
drivers on a separate dir
date:   3 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20220615 
(https://download.01.org/0day-ci/archive/20220616/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46fb99951fe2c71adfd7f4ea4439af5ed5ebb7f7
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 46fb99951fe2c71adfd7f4ea4439af5ed5ebb7f7
        # save the config file
         ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


gcc-analyzer warnings: (new ones prefixed by >>)
   In function 'pxp_try_fmt_vid_cap':
>> drivers/media/platform/nxp/imx-pxp.c:1189:18: warning: dereference of NULL 
>> 'fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1189 |         if (!(fmt->types & MEM2MEM_CAPTURE)) {
         |               ~~~^~~~~~~
     'pxp_try_fmt_vid_cap': events 1-2
       |
       | 1178 | static int pxp_try_fmt_vid_cap(struct file *file, void *priv,
       |      |            ^~~~~~~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'pxp_try_fmt_vid_cap'
       |......
       | 1184 |         fmt = find_format(f);
       |      |               ~~~~~~~~~~~~~~
       |      |               |
       |      |               (2) calling 'find_format' from 
'pxp_try_fmt_vid_cap'
       |
       +--> 'find_format': event 3
              |
              |  171 | static struct pxp_fmt *find_format(struct v4l2_format *f)
              |      |                        ^~~~~~~~~~~
              |      |                        |
              |      |                        (3) entry to 'find_format'
              |
            'find_format': events 4-6
              |
              |  176 |         for (k = 0; k < NUM_FORMATS; k++) {
              |  177 |                 fmt = &formats[k];
              |  178 |                 if (fmt->fourcc == 
f->fmt.pix.pixelformat)
              |      |                     ~~~~~~~~~~~
              |      |                        |
              |      |                        (5) ...to here
              |......
              |  182 |         if (k == NUM_FORMATS)
              |      |            ~           
              |      |            |
              |      |            (6) following 'true' branch (when 'k == 
20')...
              |
            'find_format': event 7
              |
              |cc1:
              | (7): ...to here
              |
       <------+
       |
     'pxp_try_fmt_vid_cap': events 8-11
       |
       | 1184 |         fmt = find_format(f);
       |      |               ^~~~~~~~~~~~~~
       |      |               |
       |      |               (8) return of NULL to 'pxp_try_fmt_vid_cap' from 
'find_format'
       | 1185 |         if (!fmt) {
       |      |            ~   
       |      |            |
       |      |            (9) following 'true' branch (when 'fmt' is NULL)...
       | 1186 |                 f->fmt.pix.pixelformat = formats[0].fourcc;
       |      |                                          ~~~~~~~~~~~~~~~~~
       |      |                                                    |
       |      |                                                    (10) ...to 
here
       | 1187 |                 fmt = find_format(f);
       |      |                       ~~~~~~~~~~~~~~
       |      |                       |
       |      |                       (11) calling 'find_format' from 
'pxp_try_fmt_vid_cap'
       |
       +--> 'find_format': event 12
              |
              |  171 | static struct pxp_fmt *find_format(struct v4l2_format *f)
              |      |                        ^~~~~~~~~~~
              |      |                        |
              |      |                        (12) entry to 'find_format'
              |
            'find_format': events 13-15
              |
              |  176 |         for (k = 0; k < NUM_FORMATS; k++) {
              |  177 |                 fmt = &formats[k];
              |  178 |                 if (fmt->fourcc == 
f->fmt.pix.pixelformat)
              |      |                     ~~~~~~~~~~~
              |      |                        |
              |      |                        (14) ...to here
              |......
              |  182 |         if (k == NUM_FORMATS)
              |      |            ~           
              |      |            |
              |      |            (15) following 'true' branch (when 'k == 
20')...
              |
            'find_format': event 16
              |
              |cc1:
              | (16): ...to here
              |
       <------+
       |
     'pxp_try_fmt_vid_cap': events 17-18
       |
       | 1187 |                 fmt = find_format(f);
       |      |                       ^~~~~~~~~~~~~~
       |      |                       |
       |      |                       (17) return of NULL to 
'pxp_try_fmt_vid_cap' from 'find_format'
       | 1188 |         }
       | 1189 |         if (!(fmt->types & MEM2MEM_CAPTURE)) {
       |      |               ~~~~~~~~~~
       |      |                  |
       |      |                  (18) dereference of NULL 'fmt'
--
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c: In function 
'mxc_jpeg_bytesperline':
>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1207:19: warning: dereference 
>> of NULL '*ctx.out_q.fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1207 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
         |             ~~~~~~^~~~~~~~
     'mxc_jpeg_set_default_params': events 1-2
       |
       | 1493 | static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx 
*ctx)
       |      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |             |
       |      |             (1) entry to 'mxc_jpeg_set_default_params'
       |......
       | 1500 |         if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) {
       |      |            ~ 
       |      |            |
       |      |            (2) following 'true' branch...
       |
     'mxc_jpeg_set_default_params': event 3
       |
       |cc1:
       | (3): ...to here
       |
     'mxc_jpeg_set_default_params': events 4-11
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (7) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (5) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (6) following 'false' branch...
       |......
       | 1501 |                 out_q->fmt = mxc_jpeg_find_format(ctx, 
MXC_JPEG_DEFAULT_PFMT);
       |      |                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                            |
       |      |                            (8) '*ctx.out_q.fmt' is NULL
       |......
       | 1508 |         for (i = 0; i < 2; i++) {
       |      |                     ~~~~~
       |      |                       |
       |      |                       (9) following 'true' branch (when 'i != 
2')...
       | 1509 |                 q[i]->w = MXC_JPEG_DEFAULT_WIDTH;
       |      |                 ~~~~   
       |      |                  |
       |      |                  (10) ...to here
       |......
       | 1513 |                 mxc_jpeg_bytesperline(q[i], 8);
       |      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                 |
       |      |                 (11) calling 'mxc_jpeg_bytesperline' from 
'mxc_jpeg_set_default_params'
       |
       +--> 'mxc_jpeg_bytesperline': events 12-14
              |
              | 1203 | static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data 
*q,
              |      |             ^~~~~~~~~~~~~~~~~~~~~
              |      |             |
              |      |             (12) entry to 'mxc_jpeg_bytesperline'
              |......
              | 1207 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
              |      |             ~~~~~~~~~~~~~~
              |      |              |    |
              |      |              |    (14) dereference of NULL '*q.fmt'
              |      |              (13) '*ctx.out_q.fmt' is NULL
              |
>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1207:19: warning: dereference 
>> of NULL 'tmp_q.fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1207 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
         |             ~~~~~~^~~~~~~~
     'mxc_jpeg_try_fmt_vid_out': events 1-2
       |
       | 1711 | static int mxc_jpeg_try_fmt_vid_out(struct file *file, void 
*priv,
       |      |            ^~~~~~~~~~~~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'mxc_jpeg_try_fmt_vid_out'
       |......
       | 1723 |         if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) {
       |      |            ~
       |      |            |
       |      |            (2) following 'false' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 3
       |
       |cc1:
       | (3): ...to here
       |
     'mxc_jpeg_try_fmt_vid_out': events 4-6
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (5) ...to here
       |......
       | 1729 |         if (!fmt || fmt->flags != q_type) {
       |      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |
       |      |                  (6) following 'true' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 7
       |
       | 1736 |                                 MXC_JPEG_DEFAULT_PFMT : 
V4L2_PIX_FMT_JPEG;
       |
     'mxc_jpeg_try_fmt_vid_out': events 8-12
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (11) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (9) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (10) following 'false' branch...
       |......
       | 1739 |         return mxc_jpeg_try_fmt(f, fmt, ctx, q_type);
       |      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                |
       |      |                (12) calling 'mxc_jpeg_try_fmt' from 
'mxc_jpeg_try_fmt_vid_out'
       |
       +--> 'mxc_jpeg_try_fmt': events 13-14
              |
              | 1610 | static int mxc_jpeg_try_fmt(struct v4l2_format *f, const 
struct mxc_jpeg_fmt *fmt,
              |      |            ^~~~~~~~~~~~~~~~
              |      |            |
              |      |            (13) entry to 'mxc_jpeg_try_fmt'
              |......
              | 1655 |         mxc_jpeg_bytesperline(&tmp_q, 8);
              |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |         |
              |      |         (14) calling 'mxc_jpeg_bytesperline' from 
'mxc_jpeg_try_fmt'
              |
              +--> 'mxc_jpeg_bytesperline': events 15-17
                     |
                     | 1203 | static void mxc_jpeg_bytesperline(struct 
mxc_jpeg_q_data *q,
                     |      |             ^~~~~~~~~~~~~~~~~~~~~
                     |      |             |
                     |      |             (15) entry to 'mxc_jpeg_bytesperline'
                     |......
                     | 1207 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
                     |      |             ~~~~~~~~~~~~~~
                     |      |              |    |
                     |      |              |    (17) dereference of NULL 
'*q.fmt'
                     |      |              (16) 'tmp_q.fmt' is NULL
                     |
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c: In function 
'mxc_jpeg_sizeimage':
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1229:19: warning: dereference 
of NULL '*ctx.out_q.fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1229 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
         |             ~~~~~~^~~~~~~~
     'mxc_jpeg_set_default_params': events 1-2
       |
       | 1493 | static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx 
*ctx)
       |      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |             |
       |      |             (1) entry to 'mxc_jpeg_set_default_params'
       |......
       | 1500 |         if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) {
       |      |            ~ 
       |      |            |
       |      |            (2) following 'true' branch...
       |
     'mxc_jpeg_set_default_params': event 3
       |
--
       |......
       | 1723 |         if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) {
       |      |            ~
       |      |            |
       |      |            (2) following 'false' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 3
       |
       |cc1:
       | (3): ...to here
       |
     'mxc_jpeg_try_fmt_vid_out': events 4-6
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (5) ...to here
       |......
       | 1729 |         if (!fmt || fmt->flags != q_type) {
       |      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |
       |      |                  (6) following 'true' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 7
       |
       | 1736 |                                 MXC_JPEG_DEFAULT_PFMT : 
V4L2_PIX_FMT_JPEG;
       |
     'mxc_jpeg_try_fmt_vid_out': events 8-12
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (11) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (9) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (10) following 'false' branch...
       |......
       | 1739 |         return mxc_jpeg_try_fmt(f, fmt, ctx, q_type);
       |      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                |
       |      |                (12) calling 'mxc_jpeg_try_fmt' from 
'mxc_jpeg_try_fmt_vid_out'
       |
       +--> 'mxc_jpeg_try_fmt': events 13-14
              |
              | 1610 | static int mxc_jpeg_try_fmt(struct v4l2_format *f, const 
struct mxc_jpeg_fmt *fmt,
              |      |            ^~~~~~~~~~~~~~~~
              |      |            |
              |      |            (13) entry to 'mxc_jpeg_try_fmt'
              |......
              | 1655 |         mxc_jpeg_bytesperline(&tmp_q, 8);
              |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |         |
              |      |         (14) calling 'mxc_jpeg_bytesperline' from 
'mxc_jpeg_try_fmt'
              |
              +--> 'mxc_jpeg_bytesperline': events 15-16
                     |
                     | 1203 | static void mxc_jpeg_bytesperline(struct 
mxc_jpeg_q_data *q,
                     |      |             ^~~~~~~~~~~~~~~~~~~~~
                     |      |             |
                     |      |             (15) entry to 'mxc_jpeg_bytesperline'
                     |......
                     | 1207 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
                     |      |             ~~~~~~
                     |      |              |
                     |      |              (16) 'tmp_q.fmt' is NULL
                     |
              <------+
              |
            'mxc_jpeg_try_fmt': events 17-18
              |
              | 1655 |         mxc_jpeg_bytesperline(&tmp_q, 8);
              |      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |         |
              |      |         (17) returning to 'mxc_jpeg_try_fmt' from 
'mxc_jpeg_bytesperline'
              | 1656 |         mxc_jpeg_sizeimage(&tmp_q);
              |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |         |
              |      |         (18) calling 'mxc_jpeg_sizeimage' from 
'mxc_jpeg_try_fmt'
              |
              +--> 'mxc_jpeg_sizeimage': events 19-21
                     |
                     | 1227 | static void mxc_jpeg_sizeimage(struct 
mxc_jpeg_q_data *q)
                     |      |             ^~~~~~~~~~~~~~~~~~
                     |      |             |
                     |      |             (19) entry to 'mxc_jpeg_sizeimage'
                     | 1228 | {
                     | 1229 |         if (q->fmt->fourcc == V4L2_PIX_FMT_JPEG) {
                     |      |             ~~~~~~~~~~~~~~
                     |      |              |    |
                     |      |              |    (21) dereference of NULL 
'*q.fmt'
                     |      |              (20) 'tmp_q.fmt' is NULL
                     |
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c: In function 
'mxc_jpeg_try_fmt':
>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1624:33: warning: dereference 
>> of NULL 'fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1624 |         pix_mp->num_planes = fmt->colplanes;
         |                              ~~~^~~~~~~~~~~
     'mxc_jpeg_try_fmt_vid_out': events 1-2
       |
       | 1711 | static int mxc_jpeg_try_fmt_vid_out(struct file *file, void 
*priv,
       |      |            ^~~~~~~~~~~~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'mxc_jpeg_try_fmt_vid_out'
       |......
       | 1723 |         if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) {
       |      |            ~
       |      |            |
       |      |            (2) following 'false' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 3
       |
       |cc1:
       | (3): ...to here
       |
     'mxc_jpeg_try_fmt_vid_out': events 4-6
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (5) ...to here
       |......
       | 1729 |         if (!fmt || fmt->flags != q_type) {
       |      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |
       |      |                  (6) following 'true' branch...
       |
     'mxc_jpeg_try_fmt_vid_out': event 7
       |
       | 1736 |                                 MXC_JPEG_DEFAULT_PFMT : 
V4L2_PIX_FMT_JPEG;
       |
     'mxc_jpeg_try_fmt_vid_out': events 8-12
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (11) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (9) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (10) following 'false' branch...
       |......
       | 1739 |         return mxc_jpeg_try_fmt(f, fmt, ctx, q_type);
       |      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                |
       |      |                (12) calling 'mxc_jpeg_try_fmt' from 
'mxc_jpeg_try_fmt_vid_out'
       |
       +--> 'mxc_jpeg_try_fmt': events 13-14
              |
              | 1610 | static int mxc_jpeg_try_fmt(struct v4l2_format *f, const 
struct mxc_jpeg_fmt *fmt,
              |      |            ^~~~~~~~~~~~~~~~
              |      |            |
              |      |            (13) entry to 'mxc_jpeg_try_fmt'
              |......
              | 1624 |         pix_mp->num_planes = fmt->colplanes;
              |      |                              ~~~~~~~~~~~~~~
              |      |                                 |
              |      |                                 (14) dereference of NULL 
'fmt'
              |
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c: In function 'mxc_jpeg_s_fmt':
   drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1776:50: warning: dereference 
of NULL '*ctx.out_q.fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1776 |                                       q_data->fmt->h_align,
         |                                       ~~~~~~~~~~~^~~~~~~~~
     'mxc_jpeg_s_fmt': events 1-4
       |
       | 1742 | static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx,
       |      |            ^~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'mxc_jpeg_s_fmt'
       |......
       | 1752 |         if (!vq)
       |      |            ~
       |      |            |
       |      |            (2) following 'false' branch (when 'vq' is 
non-NULL)...
       |......
       | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
       |      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |                         |
       |      |                  |                         (3) ...to here
       |      |                  (4) calling 'mxc_jpeg_get_q_data' from 
'mxc_jpeg_s_fmt'
       |
       +--> 'mxc_jpeg_get_q_data': event 5
              |
              |  420 | static struct mxc_jpeg_q_data 
*mxc_jpeg_get_q_data(struct mxc_jpeg_ctx *ctx,
              |      |                                ^~~~~~~~~~~~~~~~~~~
              |      |                                |
              |      |                                (5) entry to 
'mxc_jpeg_get_q_data'
              |
            'mxc_jpeg_get_q_data': event 6
              |
              |cc1:
              | (6): following 'default:' branch...
              |
            'mxc_jpeg_get_q_data': event 7
              |
              |  424 |                 return &ctx->out_q;
              |      |                        ^~~~~~~~~~~
              |      |                        |
              |      |                        (7) ...to here
              |
       <------+
       |
     'mxc_jpeg_s_fmt': events 8-10
       |
       | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
       |      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |
       |      |                  (8) returning to 'mxc_jpeg_s_fmt' from 
'mxc_jpeg_get_q_data'
       | 1756 | 
       | 1757 |         if (vb2_is_busy(vq)) {
       |      |            ~      
       |      |            |
       |      |            (9) following 'false' branch...
       |......
       | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
       |      |                       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                       |
       |      |                       (10) ...to here
       |
     'mxc_jpeg_s_fmt': events 11-18
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (14) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (12) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (13) following 'false' branch...
       |......
       | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
       |      |         
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                     |
       |      |                     (15) '*ctx.out_q.fmt' is NULL
       |......
       | 1768 |         if (jpeg->mode == MXC_JPEG_DECODE) {
       |      |            ~           
       |      |            |
       |      |            (16) following 'true' branch...
       |......
       | 1773 |                 v4l_bound_align_image(&q_data->w_adjusted,
       |      |                                       ~~~~~~~~~~~~~~~~~~~
       |      |                                       |
       |      |                                       (17) ...to here
       |......
       | 1776 |                                       q_data->fmt->h_align,
       |      |                                       ~~~~~~~~~~~~~~~~~~~~
       |      |                                                  |
       |      |                                                  (18) 
dereference of NULL '<unknown>'
       |
>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1776:50: warning: dereference 
>> of NULL '*ctx.cap_q.fmt' [CWE-476] [-Wanalyzer-null-dereference]
    1776 |                                       q_data->fmt->h_align,
         |                                       ~~~~~~~~~~~^~~~~~~~~
     'mxc_jpeg_s_fmt': events 1-4
       |
       | 1742 | static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx,
       |      |            ^~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'mxc_jpeg_s_fmt'
       |......
       | 1752 |         if (!vq)
       |      |            ~
       |      |            |
       |      |            (2) following 'false' branch (when 'vq' is 
non-NULL)...
       |......
       | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
       |      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |                         |
       |      |                  |                         (3) ...to here
       |      |                  (4) calling 'mxc_jpeg_get_q_data' from 
'mxc_jpeg_s_fmt'
       |
       +--> 'mxc_jpeg_get_q_data': event 5
              |
              |  420 | static struct mxc_jpeg_q_data 
*mxc_jpeg_get_q_data(struct mxc_jpeg_ctx *ctx,
              |      |                                ^~~~~~~~~~~~~~~~~~~
              |      |                                |
              |      |                                (5) entry to 
'mxc_jpeg_get_q_data'
              |
            'mxc_jpeg_get_q_data': event 6
              |
              |cc1:
              | (6): following 'case 2 ... 3:' branch...
              |
            'mxc_jpeg_get_q_data': event 7
              |
              |  425 |         return &ctx->cap_q;
              |      |                ^~~~~~~~~~~
              |      |                |
              |      |                (7) ...to here
              |
       <------+
       |
     'mxc_jpeg_s_fmt': events 8-10
       |
       | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
       |      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                  |
       |      |                  (8) returning to 'mxc_jpeg_s_fmt' from 
'mxc_jpeg_get_q_data'
       | 1756 | 
       | 1757 |         if (vb2_is_busy(vq)) {
       |      |            ~      
       |      |            |
       |      |            (9) following 'false' branch...
       |......
       | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
       |      |                       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                       |
       |      |                       (10) ...to here
       |
     'mxc_jpeg_s_fmt': events 11-18
       |
       |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
       |      |                                               ~~~
       |      |                                                |
       |      |                                                (14) ...to here
       |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
       |      |                                            ~~~
       |      |                                            |
       |      |                                            (12) ...to here
       |  393 | 
       |  394 |                 if (fmt->fourcc == pixelformat)
       |      |                    ~   
       |      |                    |
       |      |                    (13) following 'false' branch...
       |......
       | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
       |      |         
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                     |
       |      |                     (15) '*ctx.cap_q.fmt' is NULL
       |......
       | 1768 |         if (jpeg->mode == MXC_JPEG_DECODE) {
       |      |            ~           
       |      |            |
       |      |            (16) following 'true' branch...
       |......
       | 1773 |                 v4l_bound_align_image(&q_data->w_adjusted,
       |      |                                       ~~~~~~~~~~~~~~~~~~~
       |      |                                       |
       |      |                                       (17) ...to here
       |......
       | 1776 |                                       q_data->fmt->h_align,
       |      |                                       ~~~~~~~~~~~~~~~~~~~~
       |      |                                                  |
       |      |                                                  (18) 
dereference of NULL '<unknown>'
       |
>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c:1776:50: warning: dereference 
>> of NULL '0' [CWE-476] [-Wanalyzer-null-dereference]
    1776 |                                       q_data->fmt->h_align,
         |                                       ~~~~~~~~~~~^~~~~~~~~
     'mxc_jpeg_s_fmt_vid_cap.part.0': events 1-2
       |
       | 1806 | static int mxc_jpeg_s_fmt_vid_cap(struct file *file, void *priv,
       |      |            ^~~~~~~~~~~~~~~~~~~~~~
       |      |            |
       |      |            (1) entry to 'mxc_jpeg_s_fmt_vid_cap.part.0'
       |......
       | 1815 |         return mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f);
       |      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                |
       |      |                (2) calling 'mxc_jpeg_s_fmt' from 
'mxc_jpeg_s_fmt_vid_cap.part.0'
       |
       +--> 'mxc_jpeg_s_fmt': events 3-6
              |
              | 1742 | static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx,
              |      |            ^~~~~~~~~~~~~~
              |      |            |
              |      |            (3) entry to 'mxc_jpeg_s_fmt'
              |......
              | 1752 |         if (!vq)
              |      |            ~
              |      |            |
              |      |            (4) following 'false' branch (when 'vq' is 
non-NULL)...
              |......
              | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
              |      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                  |                         |
              |      |                  |                         (5) ...to here
              |      |                  (6) calling 'mxc_jpeg_get_q_data' from 
'mxc_jpeg_s_fmt'
              |
              +--> 'mxc_jpeg_get_q_data': event 7
                     |
                     |  420 | static struct mxc_jpeg_q_data 
*mxc_jpeg_get_q_data(struct mxc_jpeg_ctx *ctx,
                     |      |                                ^~~~~~~~~~~~~~~~~~~
                     |      |                                |
                     |      |                                (7) entry to 
'mxc_jpeg_get_q_data'
                     |
                   'mxc_jpeg_get_q_data': event 8
                     |
                     |cc1:
                     | (8): following 'default:' branch...
                     |
                   'mxc_jpeg_get_q_data': event 9
                     |
                     |  424 |                 return &ctx->out_q;
                     |      |                        ^~~~~~~~~~~
                     |      |                        |
                     |      |                        (9) ...to here
                     |
              <------+
              |
            'mxc_jpeg_s_fmt': events 10-12
              |
              | 1755 |         q_data = mxc_jpeg_get_q_data(ctx, f->type);
              |      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                  |
              |      |                  (10) returning to 'mxc_jpeg_s_fmt' from 
'mxc_jpeg_get_q_data'
              | 1756 | 
              | 1757 |         if (vb2_is_busy(vq)) {
              |      |            ~      
              |      |            |
              |      |            (11) following 'false' branch...
              |......
              | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
              |      |                       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                       |
              |      |                       (12) ...to here
              |
            'mxc_jpeg_s_fmt': events 13-20
              |
              |  391 |         for (k = 0; k < MXC_JPEG_NUM_FORMATS; k++) {
              |      |                                               ~~~
              |      |                                                |
              |      |                                                (16) 
...to here
              |  392 |                 const struct mxc_jpeg_fmt *fmt = 
&mxc_formats[k];
              |      |                                            ~~~
              |      |                                            |
              |      |                                            (14) ...to 
here
              |  393 | 
              |  394 |                 if (fmt->fourcc == pixelformat)
              |      |                    ~   
              |      |                    |
              |      |                    (15) following 'false' branch...
              |......
              | 1762 |         q_data->fmt = mxc_jpeg_find_format(ctx, 
pix_mp->pixelformat);
              |      |         
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                     |
              |      |                     (17) '0' is NULL
              |......
              | 1768 |         if (jpeg->mode == MXC_JPEG_DECODE) {
              |      |            ~           
              |      |            |
              |      |            (18) following 'true' branch...
              |......
              | 1773 |                 
v4l_bound_align_image(&q_data->w_adjusted,
              |      |                                       ~~~~~~~~~~~~~~~~~~~
              |      |                                       |
              |      |                                       (19) ...to here

vim +/fmt +1189 drivers/media/platform/nxp/imx-pxp.c

51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1177  
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1178  
static int pxp_try_fmt_vid_cap(struct file *file, void *priv,
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1179  
                               struct v4l2_format *f)
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1180  
{
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1181  
        struct pxp_fmt *fmt;
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1182  
        struct pxp_ctx *ctx = file2ctx(file);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1183  
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1184  
        fmt = find_format(f);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1185  
        if (!fmt) {
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1186  
                f->fmt.pix.pixelformat = formats[0].fourcc;
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1187  
                fmt = find_format(f);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1188  
        }
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06 @1189  
        if (!(fmt->types & MEM2MEM_CAPTURE)) {
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1190  
                v4l2_err(&ctx->dev->v4l2_dev,
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1191  
                         "Fourcc format (0x%08x) invalid.\n",
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1192  
                         f->fmt.pix.pixelformat);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1193  
                return -EINVAL;
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1194  
        }
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1195  
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1196  
        f->fmt.pix.colorspace = ctx->colorspace;
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1197  
        f->fmt.pix.xfer_func = ctx->xfer_func;
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1198  
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1199  
        pxp_fixup_colorimetry_cap(ctx, fmt->fourcc,
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1200  
                                  &f->fmt.pix.ycbcr_enc,
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1201  
                                  &f->fmt.pix.quantization);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1202  
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1203  
        return pxp_try_fmt(f, fmt);
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1204  
}
51abcf7fdb70b8 drivers/media/platform/imx-pxp.c Philipp Zabel 2018-09-06  1205  

:::::: The code at line 1189 was first introduced by commit
:::::: 51abcf7fdb70b82b7f8a7c177271f29aed9866bd media: imx-pxp: add i.MX Pixel 
Pipeline driver

:::::: TO: Philipp Zabel <[email protected]>
:::::: CC: Mauro Carvalho Chehab <[email protected]>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to