From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D861BC432C0 for ; Tue, 3 Dec 2019 10:22:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B613E20684 for ; Tue, 3 Dec 2019 10:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726087AbfLCKWx (ORCPT ); Tue, 3 Dec 2019 05:22:53 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:37340 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbfLCKWw (ORCPT ); Tue, 3 Dec 2019 05:22:52 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id E6E531C25CF; Tue, 3 Dec 2019 11:22:50 +0100 (CET) Date: Tue, 3 Dec 2019 11:22:50 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Chiranjeevi Rapolu , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: Re: [PATCH 4.19 211/306] media: ov13858: Check for possible null pointer Message-ID: <20191203102250.GA27320@amd> References: <20191127203114.766709977@linuxfoundation.org> <20191127203130.540872040@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <20191127203130.540872040@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Chiranjeevi Rapolu >=20 > [ Upstream commit 35629182eb8f931b0de6ed38c0efac58e922c801 ] >=20 > Check for possible null pointer to avoid crash. > diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c > index 0e7a85c4996c7..afd66d243403b 100644 > --- a/drivers/media/i2c/ov13858.c > +++ b/drivers/media/i2c/ov13858.c > @@ -1612,7 +1612,8 @@ static int ov13858_init_controls(struct ov13858 *ov= 13858) > OV13858_NUM_OF_LINK_FREQS - 1, > 0, > link_freq_menu_items); > - ov13858->link_freq->flags |=3D V4L2_CTRL_FLAG_READ_ONLY; > + if (ov13858->link_freq) > + ov13858->link_freq->flags |=3D V4L2_CTRL_FLAG_READ_ONLY; > =20 > pixel_rate_max =3D link_freq_to_pixel_rate(link_freq_menu_items[0]); > pixel_rate_min =3D I don't think this is right fix. If ov13858->link_freq initialization fails, we want to fail the initialization, not present half-initialized device to userland, no? Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl3mN3kACgkQMOfwapXb+vKiSACguJff7ExHy9eC8bWnsSV+Ndph KHcAoLasf4QJOMo9rBzIW6QdMs5qVbvq =Iz20 -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--