Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347473 > unrolled thread

[PATCH 4.4 052/342] devm_memremap: Fix error value when memremap failed

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-03-02 02:30 +0100
Last post2016-03-02 02:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.4 052/342] devm_memremap: Fix error value when memremap failed Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 02:30 +0100

#1347473 — [PATCH 4.4 052/342] devm_memremap: Fix error value when memremap failed

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-02 02:30 +0100
Subject[PATCH 4.4 052/342] devm_memremap: Fix error value when memremap failed
Message-ID<r83M0-nH-35@gated-at.bofh.it>
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Toshi Kani <toshi.kani@hpe.com>

commit 93f834df9c2d4e362dfdc4b05daa0a4e18814836 upstream.

devm_memremap() returns an ERR_PTR() value in case of error.
However, it returns NULL when memremap() failed.  This causes
the caller, such as the pmem driver, to proceed and oops later.

Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap()
failed.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/memremap.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -133,8 +133,10 @@ void *devm_memremap(struct device *dev,
 	if (addr) {
 		*ptr = addr;
 		devres_add(dev, ptr);
-	} else
+	} else {
 		devres_free(ptr);
+		return ERR_PTR(-ENXIO);
+	}
 
 	return addr;
 }

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web