linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
To: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: linux-modules <linux-modules@vger.kernel.org>
Subject: Re: [PATCH 3/3] tools: add basic versions of insert and remove
Date: Sat, 7 Mar 2015 10:39:40 -0300	[thread overview]
Message-ID: <20150307133940.GA938@gray.amr.corp.intel.com> (raw)
In-Reply-To: <CAKi4VAKWR=4-dX3u5UciAjLnQYgKdQQ+=MuY44GCC42d+ERm2w@mail.gmail.com>

Thanks! Pushed a new version of the patch fixing the minor issues.


On Fri, Mar 06, 2015 at 12:23:29AM -0300, Lucas De Marchi wrote:
> Overall it's nice, but I have some comments on this one. See below
> > +DEFINE_TEST(kmod_tool_insert,
> > +       .description = "check kmod insert",
> > +       .config = {
> > +               [TC_UNAME_R] = "4.4.4",
> > +               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-tools/insert",
> > +               [TC_INIT_MODULE_RETCODES] = "",
> 
> are these and other similar ones  correct? why do you need to set it
> to an empty string?

If TC_INIT_MODULE_RETCODES is NULL, the preload for init_module won't
be loaded, so we need it set.

When set, it will automatically succeed loading any non-builtin
modules, except those mentioned in the string, that will succeed or
not depending on the error code.

Same approach is taken by TC_DELETE_MODULE_RETCODES.


> > +       kmod_list_foreach(l, list) {
> > +               struct kmod_module *mod = kmod_module_get_module(l);
> > +
> > +               err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
> > +               if (err != 0)
> > +                       ERR("Could not insert '%s': %s\n", kmod_module_get_name(mod), mod_strerror(err));
> > +
> > +               kmod_module_unref(mod);
> 
> missing 1 unref() in the error path. Just reorder the error check with
> the unref() and you'll be fine.

ERR() doesn't return or break, each get_module() will have a
corresponding unref() call.

I've ended up rewriting the return code handling to ensure that if one
of the insertions fail, return code will be EXIT_FAILURE.


Cheers,
Caio

  reply	other threads:[~2015-03-07 13:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 16:06 [PATCH 1/3] testsuite: remove .gitignore files when populating rootfs Caio Marcelo de Oliveira Filho
2015-03-05 16:06 ` [PATCH 2/3] testsuite: update README Caio Marcelo de Oliveira Filho
2015-03-05 16:06 ` [PATCH 3/3] tools: add basic versions of insert and remove Caio Marcelo de Oliveira Filho
2015-03-06  3:23   ` Lucas De Marchi
2015-03-07 13:39     ` Caio Marcelo de Oliveira Filho [this message]
2015-03-06  3:24 ` [PATCH 1/3] testsuite: remove .gitignore files when populating rootfs Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150307133940.GA938@gray.amr.corp.intel.com \
    --to=caio.oliveira@intel.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).