[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB=NE6XD7XCmsTAg3+mw=b8WZnKJiwha5t4DBJFt5w+b_DsNkg@mail.gmail.com>
Date: Fri, 17 Apr 2020 23:48:46 -0600
From: Luis Chamberlain <mcgrof@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Shuah Khan <shuah@...nel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH 3/4] kmod: Return directly if module name is empty in request_module()
On Fri, Apr 17, 2020 at 11:45 PM Luis Chamberlain <mcgrof@...nel.org> wrote:
>
> On Sat, Apr 18, 2020 at 01:19:59PM +0800, Tiezhu Yang wrote:
> > If module name is empty, it is better to return directly at the beginning
> > of request_module() without doing the needless call_modprobe() operation.
> >
> > Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> > ---
> > kernel/kmod.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/kernel/kmod.c b/kernel/kmod.c
> > index 3cd075c..5851444 100644
> > --- a/kernel/kmod.c
> > +++ b/kernel/kmod.c
> > @@ -28,6 +28,8 @@
> >
> > #include <trace/events/module.h>
> >
> > +#define MODULE_NOT_FOUND 256
> > +
> > /*
> > * Assuming:
> > *
> > @@ -144,6 +146,9 @@ int __request_module(bool wait, const char *fmt, ...)
> > if (ret >= MODULE_NAME_LEN)
> > return -ENAMETOOLONG;
> >
> > + if (strlen(module_name) == 0)
> > + return MODULE_NOT_FOUND;
>
> I'd rather we just use something standard like -EINVAL.
> What do we return if its not found? Then use that value.
Also, are we testing for this condition yet? If not can we add one?
Powered by blists - more mailing lists