Skip to content

Commit

Permalink
bcm2835: camera: check for scene not being found
Browse files Browse the repository at this point in the history
static analysis by cppcheck detected some potential NULL pointer
dereference issues:

[drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null
  pointer dereference: scene
  (and lines 858, 859 too)

it is possible that scene is not found because of an invalue ctrl->val
and is therefore NULL and hence causing a null pointer dereference.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
  • Loading branch information
Colin Ian King authored and popcornmix committed Sep 14, 2015
1 parent 1026505 commit 0051547
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/media/platform/bcm2835/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,8 @@ static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev,
break;
}
}
if (!scene)
return -EINVAL;
if (i >= ARRAY_SIZE(scene_configs))
return -EINVAL;

Expand Down

0 comments on commit 0051547

Please sign in to comment.