Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3427289pxy; Mon, 26 Apr 2021 01:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjyZ0yUgqTDnUvN6DD4oQkRHgZaMw20RVzk6xp8e7fDFuRlB/Q471KH8AORp2UtWyIJ7tE X-Received: by 2002:aa7:d1ce:: with SMTP id g14mr19537015edp.122.1619424767363; Mon, 26 Apr 2021 01:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619424767; cv=none; d=google.com; s=arc-20160816; b=p7whyz6+ridW3XtM3fQ9qFfXnVQNZO8YhOK8GH1DjV/j0YVcJSpzQpz1OVtg1/leM9 AgqWjgji9xdJosF5OZ2N80Ih/5dwfhb4LkMd/kfjuuDFedpLlUQuc2cgajqXJ9PS/81e lH/MIp/cuWX2bwQqryAQwVgw0cuQHmJ9L3zcdUfZzyE5IlTXcndptW5w1S52vJC+Bcu3 gLTLKOPmoYDVYLehDFM3s3q0UJJKofvuUWaly+WgsyHCC2ztlO7csLk4/8pC/hsFP9c4 tVho9hPJqTF4i+gD/phqEYJKiVEE1ALFeyTNlIq87zRnoy683LgzXurXunALJMUb+K1w pqbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NAunmD5leqFPVCXRtcCWKeRfV/7q7A1rVXwUx2klV4o=; b=eg4yq+dcUvm68ohzAJLnFE8m8Z38iw5Eo+xNWnPSrVwxK7Rzc++1mrMLSoMnjDnWsY CB7ZHB9HqP7XbCZSvROKMo0UCN6fvUPEgSE2XSezDCZcXCQnola1OnRYkQhKZtA3H+CX lv4Vp9cT6Kqo35mg0kbzXC9jP7zke0AM7Goi8TCqArn1f45Sv/pImP2af0iaMx3nc1VF FVVkA5nwTzh7W5egRFCZkdZq7cEHyh0jtl0beIJiuMJtzoQZy+DFE7YbpExKVIEEteOK O5RkplLF9IWiOCGdB4VNO/xvZ5MOzV4aoQr+ruDogw2L/6dneuOo56Ki8PlsQKRODCnh 8hEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uBrtAPEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si2740946ejd.336.2021.04.26.01.12.23; Mon, 26 Apr 2021 01:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uBrtAPEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbhDZIKM (ORCPT + 99 others); Mon, 26 Apr 2021 04:10:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbhDZIKL (ORCPT ); Mon, 26 Apr 2021 04:10:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 826BB61075; Mon, 26 Apr 2021 08:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619424569; bh=N3xipdZyTQK1baUwTtMtaGa4JYA/srKU2LF77EDS5JE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uBrtAPEjBDP71kiG+DSMUamo3zwY1lJr6cP5QpJmQxKgLhW4P8LtkRWb3EGmX2rNG p7K/WS8jspJWf5vmgr2Z0U9HroWbTlqBg3ZRBGdeVpdBP1NxmZB1JwLGORskPaxF4C Vdyvrh4lA/30Zl4SDzHSQ7V2JmOKS3sMOAo4m1xI= Date: Mon, 26 Apr 2021 10:09:26 +0200 From: Greg KH To: Sherry Sun Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: fix the potential bug of dereference null return value Message-ID: References: <20210426074935.11131-1-sherry.sun@nxp.com> <20210426074935.11131-3-sherry.sun@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210426074935.11131-3-sherry.sun@nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021 at 03:49:35PM +0800, Sherry Sun wrote: > This issue is reported by Coverity Check. > In lpuart_probe, return value of function which returns null is > dereferenced without checking. > > Signed-off-by: Sherry Sun > --- > drivers/tty/serial/fsl_lpuart.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c > index 777d54b593f8..c95e71fd2ca0 100644 > --- a/drivers/tty/serial/fsl_lpuart.c > +++ b/drivers/tty/serial/fsl_lpuart.c > @@ -2589,6 +2589,9 @@ static int lpuart_probe(struct platform_device *pdev) > struct resource *res; > int ret; > > + if (!sdata) > + return -ENODEV; How can sdata be NULL? thanks, greg k-h