]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: ov13858: Check for possible null pointer
authorChiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Fri, 26 Oct 2018 15:34:30 +0000 (11:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:17:18 +0000 (09:17 +0100)
[ Upstream commit 35629182eb8f931b0de6ed38c0efac58e922c801 ]

Check for possible null pointer to avoid crash.

Signed-off-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/ov13858.c

index 0e7a85c4996c77129387d68c0c183e99ae259eee..afd66d243403b31adfa75c6e1123f99bce0ffad2 100644 (file)
@@ -1612,7 +1612,8 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
                                OV13858_NUM_OF_LINK_FREQS - 1,
                                0,
                                link_freq_menu_items);
-       ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+       if (ov13858->link_freq)
+               ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
        pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]);
        pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[1]);
@@ -1635,7 +1636,8 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
        ov13858->hblank = v4l2_ctrl_new_std(
                                ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_HBLANK,
                                hblank, hblank, 1, hblank);
-       ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+       if (ov13858->hblank)
+               ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
        exposure_max = mode->vts_def - 8;
        ov13858->exposure = v4l2_ctrl_new_std(