Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp898763img; Mon, 18 Mar 2019 17:32:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDs/uf/8QL5IC/MpCY+I9SGqR2Z8UlMPsJA+/kjvEI4JkgOtQLlA3hj9GRTecDojn4jxpU X-Received: by 2002:a17:902:329:: with SMTP id 38mr23189784pld.54.1552955558689; Mon, 18 Mar 2019 17:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552955558; cv=none; d=google.com; s=arc-20160816; b=s9zT7MA0Ju75DmFlkDoD1bAF42YZVS+LfMOCv2r0lWCm0mfVeo/DnNpv1TQu/zImlG BXDAKBj8+mEy9q4zLxw1F9L0rE6dV+YCEu8b9iZ0j9LBHbGAK+CH5awkYyGQmIktETZt jwaWPaSDr34tlSBMoc+8xGEzolv7ag/gMCIHWXXqZlG2R/kGZasYC2/xDUUTNFLlutnF 2O7FbDPOu7aZU44IsJHGClLCoa7NZvmrT5qYE4ZfOIHNGs499ZL3cxvJit8ONamybxmU iVkEAoBHggKpZZzWCWoP9GbJ+WL4bxAA4Z8aJCjMnBkvBhdUaKYffwDPVdERsCyZ06bb 068Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ooq4r/ebCnnXAe3/oQpav9WVOiGj8D+f04S8WUhRVzw=; b=ZxgMoHXGVIOopYbnYJYwsRLoRw2c53VzIR1GLFRxG2bHpU9D5cPIiy6OHpCvObyOm9 t9HXk52T9E4lKy9gwYvbLHq6dk0LYZbsanMVW1+ErQ6UWKbFxNjAQI4o5CdcT6wG+bfe W8gmruGpjTyk+BvcSavCRg6VIuAEw4bRYCZk4BLQW633rN+uyNZAG4H1z2N2s+rlBklB hAOhc8KtTMv/NGt5SAMkZa8nD7Qc3eyJMmiwC8suJMUDnqa75Xj3D7StN4YxXT9l9BQ4 bbfBakx5XpEnsl8VIWSE/W/2Ej/oD5/QQCkWvzfH/K8IXoeCAsUIi0uQkiQcdd1K/NdT 07/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=lh76zgbc; 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=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si10912584plr.136.2019.03.18.17.32.23; Mon, 18 Mar 2019 17:32:38 -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=@umn.edu header.s=google header.b=lh76zgbc; 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=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727175AbfCSAaq (ORCPT + 99 others); Mon, 18 Mar 2019 20:30:46 -0400 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:50278 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727055AbfCSAap (ORCPT ); Mon, 18 Mar 2019 20:30:45 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 25D2FAB3 for ; Tue, 19 Mar 2019 00:30:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lz_8fJ2Nh-ym for ; Mon, 18 Mar 2019 19:30:44 -0500 (CDT) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id E074D92C for ; Mon, 18 Mar 2019 19:30:43 -0500 (CDT) Received: by mail-it1-f198.google.com with SMTP id z190so6100085itc.9 for ; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=ooq4r/ebCnnXAe3/oQpav9WVOiGj8D+f04S8WUhRVzw=; b=lh76zgbc0mav3MUfU+qFag4uNnA8mal1nx7+n9/EsuuPXr/aAcS9wq0/+3v1QNUbkl LNxxgqG/XDhxhHlcNksIkw3YCSnMoKLDBTm4Or++aKyDZBaXlv0D0XtSvYqREbPdUtgt LB7QpDPQroOeUv1yop1n2TaocKgyTotypcN3urISSaoF3IRdgOPTyJ81XjBKzF+3G0sY wTAuvMU40b0pOQBwkPUqxHwZbaCTWV9EMlBmBvkG1ROOLomI03qax+8wyvKsV8/8aC4h Bw/Fp05uPwPCLYDg2I9sw9rWl4PcfJbe0lykzv0nVfWAMK8i47fLj9/mIILXtoVf8NEi 5WkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ooq4r/ebCnnXAe3/oQpav9WVOiGj8D+f04S8WUhRVzw=; b=HjxeMVWxFcVeBcgP94pP/53s1NCjoRg/G8oidJuT965Mq6ClW+EX/Ghw0k/1D89B9g yc1JU0KlvtFjH5IZ1WsrjOSo6YKat4gz72Qfg9SvSOtcWulkrIkY03a4THBjjpDAXYug hxuzk1GIzF8vquUtirXenNRvGLyAK8ceeiehDtxSSSqOrnbZqxSQXt4WjGqXkfwusOvU uWjdS/JqDw4sygiSOgFpmJ8ctn5KbQd2P04Ev0nIm9nll/F0kISre22XkdjsnFYPBk5b BmIkclVcCZFClHPI4MsGiUCTagLGDl6mk50KgIWawzpNNlRGmJM9X7kqCT8yHtHkmArf UlXQ== X-Gm-Message-State: APjAAAUBLy6p+bnd3uoN/0dCG55pHlNk6q2IjnU4rQiIPVlTFnCYdctJ krtcgx2KZ8Dtvxji8jAnHmxXngaJOQ/pfzoVu2PYwHb/KFN+HzgpceNT6ODp+y1qKc/KZfrgXlb IIS3nP/YlQlFGndDCIytt5J/DUlCS X-Received: by 2002:a24:e502:: with SMTP id g2mr969845iti.78.1552955443538; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) X-Received: by 2002:a24:e502:: with SMTP id g2mr969834iti.78.1552955443357; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) Received: from lenovo-1.hsd1.mn.comcast.net (c-73-242-25-233.hsd1.mn.comcast.net. [73.242.25.233]) by smtp.googlemail.com with ESMTPSA id r2sm456894itk.5.2019.03.18.17.30.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 17:30:42 -0700 (PDT) From: Aditya Pakki To: pakki001@umn.edu 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 Subject: [PATCH] scsi: ufs: Fix to avoid a potential NULL pointer dereference Date: Mon, 18 Mar 2019 19:30:38 -0500 Message-Id: <20190319003038.12896-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; vops = (struct ufs_hba_variant_ops *)of_id->data; /* Perform generic probe */ -- 2.17.1