[bug report] media: v4l2-flash-led-class: Create separate sub-devices for indicators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Sakari Ailus,

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

The patch 503dd28af108: "media: v4l2-flash-led-class: Create separate 
sub-devices for indicators" from Jul 18, 2017, leads to the following 
Smatch complaint:

drivers/media/v4l2-core/v4l2-flash-led-class.c:210 v4l2_flash_s_ctrl()
	 error: we previously assumed 'fled_cdev' could be null (see line 200)

drivers/media/v4l2-core/v4l2-flash-led-class.c
   199		struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
   200		struct led_classdev *led_cdev = fled_cdev ? &fled_cdev->led_cdev : NULL;
                                                ^^^^^^^^^
The patch adds a new check for NULL here

   201		struct v4l2_ctrl **ctrls = v4l2_flash->ctrls;
   202		bool external_strobe;
   203		int ret = 0;
   204	
   205		switch (c->id) {
   206		case V4L2_CID_FLASH_LED_MODE:
   207			switch (c->val) {
   208			case V4L2_FLASH_LED_MODE_NONE:
   209				led_set_brightness_sync(led_cdev, LED_OFF);
   210				return led_set_flash_strobe(fled_cdev, false);
                                                            ^^^^^^^^^
but we had an old unchecked dereference here.

   211			case V4L2_FLASH_LED_MODE_FLASH:
   212				/* Turn the torch LED off */

regards,
dan carpenter



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux