brcm2708: switch to linux 4.4 and update patches
[openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0174-bcm2835-camera-check-for-scene-not-being-found.patch
1 From e9b089f99bf763bf803f82201cbb35251b6d8945 Mon Sep 17 00:00:00 2001
2 From: Colin Ian King <colin.king@canonical.com>
3 Date: Wed, 2 Sep 2015 07:33:39 -0400
4 Subject: [PATCH 174/222] bcm2835: camera: check for scene not being found
5
6 static analysis by cppcheck detected some potential NULL pointer
7 dereference issues:
8
9 [drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null
10   pointer dereference: scene
11   (and lines 858, 859 too)
12
13 it is possible that scene is not found because of an invalue ctrl->val
14 and is therefore NULL and hence causing a null pointer dereference.
15
16 Signed-off-by: Colin Ian King <colin.king@canonical.com>
17 ---
18  drivers/media/platform/bcm2835/controls.c | 2 ++
19  1 file changed, 2 insertions(+)
20
21 --- a/drivers/media/platform/bcm2835/controls.c
22 +++ b/drivers/media/platform/bcm2835/controls.c
23 @@ -845,6 +845,8 @@ static int ctrl_set_scene_mode(struct bm
24                                 break;
25                         }
26                 }
27 +               if (!scene)
28 +                       return -EINVAL;
29                 if (i >= ARRAY_SIZE(scene_configs))
30                         return -EINVAL;
31