From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbdA3LQk (ORCPT ); Mon, 30 Jan 2017 06:16:40 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:38655 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606AbdA3LQV (ORCPT ); Mon, 30 Jan 2017 06:16:21 -0500 Date: Mon, 30 Jan 2017 12:15:53 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Thierry Reding Cc: Shailendra Verma , Laxman Dewangan , Wolfram Sang , Stephen Warren , Alexandre Courbot , linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma Subject: Re: [PATCH] I2c: busses - Fix possible NULL derefrence. Message-ID: <20170130111553.cbwxu23lzd46qtt7@pengutronix.de> References: <1485752587-30107-1-git-send-email-shailendra.v@samsung.com> <20170130071217.GG3585@ulmo.ba.sec> <20170130080715.wuvx7ro3kuneolnu@pengutronix.de> <20170130085455.GP3585@ulmo.ba.sec> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170130085455.GP3585@ulmo.ba.sec> User-Agent: Mutt/1.6.2-neo (2016-06-11) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 30, 2017 at 09:54:55AM +0100, Thierry Reding wrote: > On Mon, Jan 30, 2017 at 09:07:15AM +0100, Uwe Kleine-König wrote: > > Hello, > > > > On Mon, Jan 30, 2017 at 08:12:17AM +0100, Thierry Reding wrote: > > > On Mon, Jan 30, 2017 at 10:33:07AM +0530, Shailendra Verma wrote: > > > > of_device_get_match_data could return NULL, and so can cause > > > > a NULL pointer dereference later. > > > > > > > > Signed-off-by: Shailendra Verma > > > > --- > > > > drivers/i2c/busses/i2c-tegra.c | 4 ++++ > > > > 1 file changed, 4 insertions(+) > > > > > > This will never happen. Any match in the OF table that would cause the > > > ->probe() to occur has a valid .data pointer associated with it. > > > > Theoretically you could (I think) bind that driver to a node with > > > > compatible = "tegra-i2c"; > > That's not a valid compatible string and I don't think this could end up > anywhere that would make the driver bind. Even if it did I think it'd be Look at platform_match() in drivers/base/platform.c. If of_driver_match_device fails it might still match based on strcmp(pdev->name, drv->name). Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |