Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3587281pxy; Mon, 26 Apr 2021 05:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNykDgUxAC1kjRDh5IMEkCNnfv0xmwDFScFF5jp63wUyrOsWZ9JaAwx7iTSnpW/p6fcSN8 X-Received: by 2002:a63:d507:: with SMTP id c7mr16555750pgg.306.1619439824978; Mon, 26 Apr 2021 05:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619439824; cv=none; d=google.com; s=arc-20160816; b=d+fSro0YCpUnKr31HFnhi+JZnXEepsEyhYy7qa2bzt2E7x506X6PS+DLCIA9a0qhpn of0Gfzfeb4PmF8iLJ6DsY1byOKOVBBy7AEmkveAoiTXnq15r6uIJ35eHa7gxXFqV2tAL K6SqmzlBC9qLfa0UrRFbN6dsg0sB84KXpn4YJIS0kEZj0ZH+SpQ7Q4wFMXBXYQC/9wgR 9OwimIweGrZAepe5ODiX4CROwsEZEUtEo5w2Uwe5Mn0DWNjrMwptShHwnAyINijfWiNm KIhAVj8mcrWZhMJB2yAbndA/+/AkHU3UEKhm2esEFZWC9rVVRvyxVM5vTbshXV+ZICYK V1+g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=k8SgXN+s6v6YYOZwULT1PdzSTqB9RbppBZ688Vgim+8=; b=H5WRlcbilI9Q1A0No1CIAgyxN8oECm2NpjcqAME1mUXLnCjEQpNJJVqPAqW5fVjae1 tjoUzc4xIz/Qi8wUpzbWNonCwLsqsJw78dLttqhT6fBIAtlzb1+bvxXd7grECdAiMhoz JaIoOROIA+KRW2m5Eu+3XlNwYYho/BxK/pmfkI5TZdXA6BfYZnSh5Gn2t7yNT7bpi3Na Q+yYjvNWO+dsbwRTbtqbnlHRo+VD/4gVIVRJuDXilNjaCVaIPt84sfssYBktdlJi7Xvv YC7vrqULFkD5XICBr4wM3WTKGPFOH4P3bnG2sXHh2D5m72frZxsxbMOtPlXoMuCMrUW5 bePw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u+uxDdL/"; 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 h66si17939353pfb.66.2021.04.26.05.23.32; Mon, 26 Apr 2021 05:23:44 -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="u+uxDdL/"; 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 S233294AbhDZMX2 (ORCPT + 99 others); Mon, 26 Apr 2021 08:23:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:47510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232575AbhDZMXX (ORCPT ); Mon, 26 Apr 2021 08:23:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B523A61176; Mon, 26 Apr 2021 12:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619439757; bh=DI/2ZhwMC67aq53smebwkDVY0NUjo0VkDaa5MUtRSmQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u+uxDdL/1t6gXfqWBO4APU6dhN85Wm4hBIHC7c6txaX1ngLn54SvBRjIGaQR/zPx7 GsDnIRcyCS+eSwff8aWZvhBuggfQGz6M2cb/gEkt2QYEHVwDeHqxO8r4kTJerPpZdV n2WMbeR06/JJIrOZ2r7PuqUMsmfsK9S/5tm9ak5g= Date: Mon, 26 Apr 2021 14:22:34 +0200 From: Greg KH To: Sherry Sun Cc: "jirislaby@kernel.org" , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021 at 11:39:03AM +0000, Sherry Sun wrote: > Hi Greg, > > > -----Original Message----- > > From: Greg KH > > Sent: 2021年4月26日 16:09 > > To: Sherry Sun > > Cc: jirislaby@kernel.org; linux-serial@vger.kernel.org; linux- > > kernel@vger.kernel.org; dl-linux-imx > > Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: fix the potential bug of > > dereference null return value > > > > 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? > > Is it possible that a case forgot to set sdata? Then the value will be NULL, such as { .compatible = "fsl,imx8qxp-lpuart", }. If a case forgets to set that somehow, then the driver will never work with that kernel change, so someone better not submit that update :) No need to check for something that is impossible to hit. thanks, greg k-h