linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kitakar@gmail.com
Cc: linux-media@vger.kernel.org
Subject: [bug report] media: atomisp: add NULL check for asd obtained from atomisp_video_pipe
Date: Mon, 22 Nov 2021 10:41:23 +0300	[thread overview]
Message-ID: <20211122074122.GA6581@kili> (raw)

Hello Tsuchiya Yuto,

This is a semi-automatic email about new static checker warnings.

The patch c10bcb13462e: "media: atomisp: add NULL check for asd 
obtained from atomisp_video_pipe" from Oct 18, 2021, leads to the 
following Smatch complaint:

drivers/staging/media/atomisp/pci/atomisp_ioctl.c:1188 __atomisp_reqbufs()
warn: variable dereferenced before check 'asd' (see line 1185)
drivers/staging/media/atomisp/pci/atomisp_cmd.c:5192 atomisp_set_fmt_to_isp()
warn: variable dereferenced before check 'asd' (see line 5188)

drivers/staging/media/atomisp/pci/atomisp_ioctl.c
  1175  int __atomisp_reqbufs(struct file *file, void *fh,
  1176                        struct v4l2_requestbuffers *req)
  1177  {
  1178          struct video_device *vdev = video_devdata(file);
  1179          struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
  1180          struct atomisp_sub_device *asd = pipe->asd;
  1181          struct ia_css_frame_info frame_info;
  1182          struct ia_css_frame *frame;
  1183          struct videobuf_vmalloc_memory *vm_mem;
  1184		u16 source_pad = atomisp_subdev_source_pad(vdev);
  1185		u16 stream_id = atomisp_source_pad_to_stream_id(asd, source_pad);
                                                                ^^^
There is an unchecked dereference inside this function.

  1186		int ret = 0, i = 0;
  1187	
  1188		if (!asd) {
                    ^^^^
This new check is too late.

  1189			dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n",
  1190				__func__, vdev->name);

atomisp_set_fmt_to_isp() has the same thing.

regards,
dan carpenter

             reply	other threads:[~2021-11-22  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  7:41 Dan Carpenter [this message]
2021-12-01 14:28 ` [bug report] media: atomisp: add NULL check for asd obtained from atomisp_video_pipe Tsuchiya Yuto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122074122.GA6581@kili \
    --to=dan.carpenter@oracle.com \
    --cc=kitakar@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).