From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753038AbdBRKyd (ORCPT ); Sat, 18 Feb 2017 05:54:33 -0500 Received: from fieber.vanmierlo.com ([84.243.197.177]:51067 "EHLO kerio9.vanmierlo.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752667AbdBRKyb (ORCPT ); Sat, 18 Feb 2017 05:54:31 -0500 X-Greylist: delayed 1890 seconds by postgrey-1.27 at vger.kernel.org; Sat, 18 Feb 2017 05:53:33 EST X-Footer: dmFubWllcmxvLmNvbQ== MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 18 Feb 2017 11:25:19 +0100 From: Maarten Brock To: Greg Kroah-Hartman Cc: Shailendra Verma , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , linux-serial-owner@vger.kernel.org Subject: Re: [PATCH] Tty: serial - Fix possible NULL derefrence. In-Reply-To: <20170130193743.GB27138@kroah.com> References: <1485515773-3542-1-git-send-email-shailendra.v@samsung.com> <20170130193743.GB27138@kroah.com> Message-ID: User-Agent: Roundcube Webmail/1.2.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Greg, Does that also mean that this isn't possible in the sc16is7xx.c driver in sc16is7xx_spi_probe() line 1358 and sc16is7xx_i2c_probe() line 1419 ? If so, should these checks be removed? Kind regards, Maarten On 2017-01-30 20:37, Greg Kroah-Hartman wrote: > On Fri, Jan 27, 2017 at 04:46:13PM +0530, Shailendra Verma wrote: >> of_match_device could return NULL, and so can cause a NULL >> pointer dereference later. >> >> Signed-off-by: Shailendra Verma >> --- >> drivers/tty/serial/max310x.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/tty/serial/max310x.c >> b/drivers/tty/serial/max310x.c >> index 8a3e926..a94d147 100644 >> --- a/drivers/tty/serial/max310x.c >> +++ b/drivers/tty/serial/max310x.c >> @@ -1323,6 +1323,10 @@ static int max310x_spi_probe(struct spi_device >> *spi) >> if (spi->dev.of_node) { >> const struct of_device_id *of_id = >> of_match_device(max310x_dt_ids, &spi->dev); >> + if (!of_id) { >> + dev_err(&spi->dev, "Error: No device match found\n"); >> + return -ENODEV; >> + } > > Patch now dropped as this isn't possible. > > thanks, > > greg k-h > -- > To unsubscribe from this list: send the line "unsubscribe linux-serial" > in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html