Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp940625img; Mon, 18 Mar 2019 18:46:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDxtSaZ/+OeI+MTAQHppFfBj7x5MJh7aVSrEqmyPE4s7FpdYuzx+Zb9sCUp3FQWYDU+bmC X-Received: by 2002:a17:902:784c:: with SMTP id e12mr22762408pln.117.1552959996820; Mon, 18 Mar 2019 18:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552959996; cv=none; d=google.com; s=arc-20160816; b=j/HeZdiesRK/eTvP4MIsqz+lkd35E7NrUF+4W1ABxx8z7IJoREy5QPK7ihlgljrXZT f7IweiCneokwWxpo9LpdGFo7apRH1B37ceC7fWHBoog/Ek43kVyInB1KaBggexo/9Lpr /4U+Rsh7YW3ZOQsdgFbZ5ujZOdT2ARIqa8Js46Lna1cjGw24pwE+jF7YAsEiLwBZW6hH 3OP0R6zbxy87oR6oYYAmVbQqU17rxbk6IRNAZChtz8X0bEWDgq0B7t6xfJ9ku8ej7eIO AtGG7dyPmS+tgUu4Q1URFS54DRR8Pvulb8kfiNU/sey/U8+uq3tkmBzxx0MYJCVimBem 9NUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UAp/nnHyZc5N/Vnxi/U3ObjewAAX8ANVXaWAzjnq4+s=; b=mVAbejRlJIVdGhURyeuGdTOye3017+Ohx4yw9hH6s/BcBkBqf+B2NYHHRDtiUOPhE9 +9ovKRtIJwosIfbbPFcpu9gHPKc+1U/Wh8M9ObSfDgLXzuCRYQ3BJJVmtaKISh/qPrDw QmGhuwC/XMTnEGlNSYEEXHDbv6t4ltXhlRaE1WMSbYFLfUkwyQv6bZYWurj1qfEsoyz4 /adhpv7fj2UBgIq7hzd8QSmHOIy0kQ9uiCBW3o3nW0qwAfuTEYzWtMVZM0gsga7wcExC LZcQ89oDUky1Mjg+S12ReNUQ07u3ids8B8hlxoya2wjfwSXhx09ugFCka8QImKMlHZuS LnbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s192G3Bk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si10341361plt.77.2019.03.18.18.46.21; Mon, 18 Mar 2019 18:46:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s192G3Bk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727000AbfCSBpq (ORCPT + 99 others); Mon, 18 Mar 2019 21:45:46 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40301 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726639AbfCSBpq (ORCPT ); Mon, 18 Mar 2019 21:45:46 -0400 Received: by mail-wr1-f66.google.com with SMTP id t5so19174486wri.7; Mon, 18 Mar 2019 18:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UAp/nnHyZc5N/Vnxi/U3ObjewAAX8ANVXaWAzjnq4+s=; b=s192G3BkO0x5KVj16VAtbbZgWuLFYz4UiAgoMOPRvHUtiMnCLhezY1kDFcNbGNxQta YACyR+y7MAt0csIVO6V6aPxipBAeoIJTPwPqmz7EAdWjgG20+upjfg9gYp/W66ktn6fy dT0n5Wb72+UN8ScdYS6xO61r28hY4Y9X3z2BTk0xZdZROUtM18RvNM07EPHq5GSZSMQ8 mrhB1eAoG/umSkytc24VGwjMIsHsxlWHHWl0YcYmLi66NbzqndGkyiuxvcRHmxBEsmZT qJos3lgemOrn6VusTOGxPflcKbfbNPXWg5jdyDtkyfgQndhBfjTP1JRhUMzBwnnQepPD Zbfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UAp/nnHyZc5N/Vnxi/U3ObjewAAX8ANVXaWAzjnq4+s=; b=THfbLDsVupXNMJmcNJPB5rZMpYVE6tusxlPjvef0U9/xNhgFjfJq/aGEIA768Q4fZF 8ww2XMtc2L03gCVIEO/o+DUD2JhyCueFTsmiN4rWE9M2o1Iqj7Y+a3AL/aoA3LUOcU2r qpjxGWARUhofdo5cJupxIXxtZZ9aOFqKpjeS8Vlu0lkPVVfnL7YWcACUROiTcXhKQB5Z fEcWyJgE9zkwz80hBjT17qKlMayJOr4SGTiEaXd0++10c5SrGr1iQYLQBXWFbFUJ3q9Y iFy/oRJN6mzeQTTGBtld2SIPD7bJ2kw1TBee/WW51nvlqmH3joUGfebPOfsJ38Kj59lv xdVA== X-Gm-Message-State: APjAAAWdqRm7c/M72CsN6VTbLlqETWsXhC+X3aXFhpruTJerza9hLVQE B/yX3Nsv4uZqvANzMvhaBY+jL51JLW160IZENPw= X-Received: by 2002:adf:e949:: with SMTP id m9mr15363915wrn.1.1552959944011; Mon, 18 Mar 2019 18:45:44 -0700 (PDT) MIME-Version: 1.0 References: <20190319003038.12896-1-pakki001@umn.edu> In-Reply-To: <20190319003038.12896-1-pakki001@umn.edu> From: Alim Akhtar Date: Tue, 19 Mar 2019 07:15:07 +0530 Message-ID: Subject: Re: [PATCH] scsi: ufs: Fix to avoid a potential NULL pointer dereference To: Aditya Pakki Cc: kjlu@umn.edu, Pedro Sousa , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 19, 2019 at 6:01 AM Aditya Pakki wrote: > > In tc_dwc_g210_pltfm_probe, of_match_node can return a NULL pointer > in case of failure. The patch avoids a potential NULL pointer dereference > in such scenarios. > > Signed-off-by: Aditya Pakki > --- > drivers/scsi/ufs/tc-dwc-g210-pltfrm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c > index 6dfe5a9206e9..2b5bc6bd715e 100644 > --- a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c > +++ b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c > @@ -61,6 +61,8 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > > of_id = of_match_node(tc_dwc_g210_pltfm_match, dev->of_node); > + if (!of_id) > + return -ENXIO; May be just return -ENODEV > vops = (struct ufs_hba_variant_ops *)of_id->data; > > /* Perform generic probe */ > -- > 2.17.1 > -- Regards, Alim