From dc06dd1f881df7831a007160c58dde00edab3f3b Mon Sep 17 00:00:00 2001 From: Shiyang Ruan Date: Mon, 15 Mar 2021 06:43:55 +0000 Subject: [PATCH] device-dax: Fix default return code of range_parse() stable inclusion from stable-5.10.20 commit fc22917f48ee61eebfc462de92a685b9f508bddc bugzilla: 50608 -------------------------------- [ Upstream commit 7323fb22f05ff1d20498d267828870a5fbbaebd6 ] The return value of range_parse() indicates the size when it is positive. The error code should be negative. Signed-off-by: Shiyang Ruan Reviewed-by: Joao Martins Link: https://lore.kernel.org/r/20210126021331.1059933-1-ruansy.fnst@cn.fujitsu.com Reported-by: Zhang Qilong Fixes: 8490e2e25b5a ("device-dax: add a range mapping allocation attribute") Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Signed-off-by: Chen Jun Acked-by: Xie XiuQi Signed-off-by: Zheng Zengkai --- drivers/dax/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index de7b74505e75..c1d379bd7af3 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -1046,7 +1046,7 @@ static ssize_t range_parse(const char *opt, size_t len, struct range *range) { unsigned long long addr = 0; char *start, *end, *str; - ssize_t rc = EINVAL; + ssize_t rc = -EINVAL; str = kstrdup(opt, GFP_KERNEL); if (!str) -- GitLab