All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: linux-media@vger.kernel.org
Subject: [bug report] media: cx18: Access v4l2_fh from file
Date: Mon, 18 Aug 2025 12:54:00 +0300	[thread overview]
Message-ID: <aKL4OMWsESUdX8KQ@stanley.mountain> (raw)

Hello Jacopo Mondi,

Commit 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") from
Aug 10, 2025 (linux-next), leads to the following Smatch static
checker warning:

drivers/media/pci/cx18/cx18-driver.c:1223 cx18_init_on_first_open() error: NULL dereference inside function
drivers/media/pci/cx18/cx18-driver.c:1229 cx18_init_on_first_open() error: NULL dereference inside function
drivers/media/pci/cx18/cx18-driver.c:1230 cx18_init_on_first_open() error: NULL dereference inside function
drivers/media/pci/ivtv/ivtv-driver.c:1313 ivtv_init_on_first_open() error: NULL dereference inside function
drivers/media/pci/ivtv/ivtv-driver.c:1319 ivtv_init_on_first_open() error: NULL dereference inside function

drivers/media/pci/cx18/cx18-driver.c
    1214         /* Set initial frequency. For PAL/SECAM broadcasts no
    1215            'default' channel exists AFAIK. */
    1216         if (cx->std == V4L2_STD_NTSC_M_JP)
    1217                 vf.frequency = 1460;        /* ch. 1 91250*16/1000 */
    1218         else if (cx->std & V4L2_STD_NTSC_M)
    1219                 vf.frequency = 1076;        /* ch. 4 67250*16/1000 */
    1220 
    1221         video_input = cx->active_input;
    1222         cx->active_input++;        /* Force update of input */
--> 1223         cx18_s_input(NULL, &fh, video_input);
                              ^^^^
The patch adds a new dereference of "file" but some of the callers pass a
NULL pointer.

    1224 
    1225         /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code
    1226            in one place. */
    1227         cx->std++;                /* Force full standard initialization */
    1228         std = (cx->tuner_std == V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner_std;
    1229         cx18_s_std(NULL, &fh, std);
    1230         cx18_s_frequency(NULL, &fh, &vf);
    1231         return 0;
    1232 }

regards,
dan carpenter

             reply	other threads:[~2025-08-18  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18  9:54 Dan Carpenter [this message]
2025-08-18 11:17 ` [bug report] media: cx18: Access v4l2_fh from file Jacopo Mondi
2025-08-18 11:29   ` Hans Verkuil
2025-08-18 11:37     ` Jacopo Mondi

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=aKL4OMWsESUdX8KQ@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=jacopo.mondi@ideasonboard.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.