Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp296174imm; Thu, 5 Jul 2018 00:02:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6lwWaC4cXPq32MoP7NV5PefYVLextZG6SKP8dBINOXWpFFHRTxUVGaGF7PKAaLAwBeC7P X-Received: by 2002:a17:902:3303:: with SMTP id a3-v6mr4933178plc.209.1530774149841; Thu, 05 Jul 2018 00:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530774149; cv=none; d=google.com; s=arc-20160816; b=TDBTTm2L+Y5YGvWZAtvMJ3c1SllMQWia0sLd3hGg+9D81UydQ2lw6q++MsbMyIg+NK o0/C0LdwktQPiBjUwzg3IpTwDMfKb/FZXhEZoJGOUTYx65PAunlU0XXbIMNuVBiZFQYX /Pu9U5oFlU3MbZUCF9BWEBLlSbDmE5Z5uCHTTRdXyeU3ojJRS7K44G01hW3gIvVYqDN8 VU+sfKpet3SsVYMRht95BtjRBhcKfVO8y5ZSeG+QDdt1e9iF+pY9LE6oRhvim7U5Jwbb hrI98nqhwLl8wRplYrLRrt7VhBctTGBsjiJNxarNJBiBBpRMwAvZ16bVgzZUnTBYktyq OH0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=JZVKZudZ2e9Gxl9A27oiEK19l/Tgm4N/lY57RGoU+Vs=; b=jZZ/4byo0g9FDl9nlWarZhXgWngqCiCftIYT75QTqAjuHQzWwpxkWxyGmOxB+dic7G UnIeA/4Ran1LT/KMo2qxxsRS7Dc7nSDCP5vZ2bVUJVsCsCA0oVbjWXLtrsEJO2GejdiX KGZTHHmwGdtrBGWMNvaCWFBWBepoGN/zC9Epj5LYG3fKcIfO3y5FJaVd+q+Z6lmtj1la zOh1QmQVIIQPnp3sWoQ4+eWPzKYPaMAI3giamxEmFAzQzWkTfnujwtWvXVUnR76SYxln d3WrELiTixeFPdbMhxWcfBbSD36EKq0Xq3KsK28NwqCLgJ7GTetGsPTVab+W4RdQ7s+W U4wQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17-v6si5948826pfd.76.2018.07.05.00.02.14; Thu, 05 Jul 2018 00:02:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753533AbeGEG7s (ORCPT + 99 others); Thu, 5 Jul 2018 02:59:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:51756 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbeGEG7o (ORCPT ); Thu, 5 Jul 2018 02:59:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2018 23:59:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,311,1526367600"; d="scan'208";a="70215726" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001.jf.intel.com with ESMTP; 04 Jul 2018 23:59:43 -0700 Subject: [PATCH 08/13] s390/block/dcssblk: check the validity of the pointer pfn From: Dan Williams To: akpm@linux-foundation.org Cc: Huaisheng Ye , Jan Kara , vishal.l.verma@intel.com, hch@lst.de, linux-nvdimm@lists.01.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 04 Jul 2018 23:49:45 -0700 Message-ID: <153077338570.40830.10517740093746798315.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153077334130.40830.2714147692560185329.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153077334130.40830.2714147692560185329.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huaisheng Ye direct_access needs to check the validity of pointer pfn for NULL assignment. If pfn equals to NULL, it doesn't need to calculate the value. Signed-off-by: Huaisheng Ye Reviewed-by: Jan Kara Signed-off-by: Dan Williams --- drivers/s390/block/dcssblk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index ed607288e696..a645b2c93c34 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -923,8 +923,9 @@ __dcssblk_direct_access(struct dcssblk_dev_info *dev_info, pgoff_t pgoff, dev_sz = dev_info->end - dev_info->start + 1; *kaddr = (void *) dev_info->start + offset; - *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), - PFN_DEV|PFN_SPECIAL); + if (pfn) + *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), + PFN_DEV|PFN_SPECIAL); return (dev_sz - offset) / PAGE_SIZE; }