devm_memremap: Fix error value when memremap failed
Subsystems (2)
PATCH 1/1 devm_memremap: Fix error value when memremap failed
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.
--- kernel/memremap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/memremap.c +3 -1
@@ -136,8 +136,10 @@ void *devm_memremap(struct device *dev, resource_size_t offset,if (addr) { *ptr = addr;devres_add (dev, ptr); - }else + }else {devres_free (ptr); +return ERR_PTR (-ENXIO ); + }return addr; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Toshi Kani
devm_memremap()returns anERR_PTR()value in case of error. However, it returns NULL whenmemremap()failed. This causes the caller, such as the pmem driver, to proceed and oops later.Change
devm_memremap()to returnERR_PTR(-ENXIO)whenmemremap()failed.Signed-off-by Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Cc Andrew Morton <[email protected]>
Yep, good catch.
Quoted 20 lines
--- kernel/memremap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/memremap.c +3
-1@@ -136,8 +136,10 @@ void *devm_memremap(struct device *dev, resource_size_t offset,if (addr) { *ptr = addr;devres_add (dev, ptr); - }else + }else {devres_free (ptr); +return ERR_PTR (-ENXIO ); + }return addr; }
Quoted 4 lines
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Toshi Kani
devm_memremap()returns anERR_PTR()value in case of error. However, it returns NULL whenmemremap()failed. This causes the caller, such as the pmem driver, to proceed and oops later.Change
devm_memremap()to returnERR_PTR(-ENXIO)whenmemremap()failed.Signed-off-by Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Cc Andrew Morton <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Dan Williams
Quoted 4 lines · Toshi Kani
devm_memremap()returns anERR_PTR()value in case of error. However, it returns NULL whenmemremap()failed. This causes the caller, such as the pmem driver, to proceed and oops later.
Quoted 8 lines
Quoted 6 lines
Change
devm_memremap()to returnERR_PTR(-ENXIO)whenmemremap()failed.Signed-off-by Toshi Kani <[email protected]>Cc Dan Williams <[email protected]>Cc Andrew Morton <[email protected]>Acked-by Dan Williams <[email protected]>
Should also go to -stable, I'll add that and include this with some other fixes I have brewing.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>