Message ID | 20210126021331.1059933-1-ruansy.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 7323fb22f05ff1d20498d267828870a5fbbaebd6 |
Headers | show |
Series | dax: fix default return code of range_parse() | expand |
ping On 2021/1/26 上午10:13, Shiyang Ruan wrote: > The return value of range_parse() indicates the size when it is > positive. The error code should be negative. > > Signed-off-by: Shiyang Ruan <ruansy.fnst@cn.fujitsu.com> > --- > 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 737b207c9e30..3003558c1a8b 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -1038,7 +1038,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) >
On 1/26/21 2:13 AM, Shiyang Ruan wrote: > The return value of range_parse() indicates the size when it is > positive. The error code should be negative. > > Signed-off-by: Shiyang Ruan <ruansy.fnst@cn.fujitsu.com> Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Although, FWIW, there was another patch exactly like this a couple months ago, albeit it didn't get pulled for some reason: https://lore.kernel.org/linux-nvdimm/20201026110425.136629-1-zhangqilong3@huawei.com/ > --- > 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 737b207c9e30..3003558c1a8b 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -1038,7 +1038,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) >
On Wed, Feb 10, 2021 at 10:19 AM Joao Martins <joao.m.martins@oracle.com> wrote: > > On 1/26/21 2:13 AM, Shiyang Ruan wrote: > > The return value of range_parse() indicates the size when it is > > positive. The error code should be negative. > > > > Signed-off-by: Shiyang Ruan <ruansy.fnst@cn.fujitsu.com> > > Reviewed-by: Joao Martins <joao.m.martins@oracle.com> > > Although, FWIW, there was another patch exactly like this a couple > months ago, albeit it didn't get pulled for some reason: > > https://lore.kernel.org/linux-nvdimm/20201026110425.136629-1-zhangqilong3@huawei.com/ Apologies for missing these... applied now.
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 737b207c9e30..3003558c1a8b 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -1038,7 +1038,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)
The return value of range_parse() indicates the size when it is positive. The error code should be negative. Signed-off-by: Shiyang Ruan <ruansy.fnst@cn.fujitsu.com> --- drivers/dax/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)