linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: Yauheni Kaliuta <ykaliuta@redhat.com>
Cc: linux-modules@vger.kernel.org, lucas.de.marchi@gmail.com
Subject: Re: [PATCH 1/2] libkmod-module: check "new_from_name" return value in get_builtin
Date: Wed, 9 Jun 2021 10:22:15 -0700	[thread overview]
Message-ID: <20210609172215.4qkrxtkbfjq3cs2u@ldmartin-desk2> (raw)
In-Reply-To: <20210608062923.94017-1-ykaliuta@redhat.com>

On Tue, Jun 08, 2021 at 09:29:22AM +0300, Yauheni Kaliuta wrote:
>kmod_module_new_from_name() may fail and return error value. It is
>handled properly across the code, but in this particular place the
>check is missing.
>
>Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>

applied, thanks

Lucas De Marchi

>---
> libkmod/libkmod-module.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
>diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
>index b6320cc87e80..6e0ff1a99604 100644
>--- a/libkmod/libkmod-module.c
>+++ b/libkmod/libkmod-module.c
>@@ -2912,7 +2912,10 @@ int kmod_module_get_builtin(struct kmod_ctx *ctx, struct kmod_list **list)
> 			goto fail;
> 		}
>
>-		kmod_module_new_from_name(ctx, modname, &mod);
>+		err = kmod_module_new_from_name(ctx, modname, &mod);
>+		if (err < 0)
>+			goto fail;
>+
> 		kmod_module_set_builtin(mod, true);
>
> 		*list = kmod_list_append(*list, mod);
>-- 
>2.31.1
>

      parent reply	other threads:[~2021-06-09 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  6:28 [PATCH 0/2] Fix a couple of potential problem (static analysis) Yauheni Kaliuta
2021-06-08  6:29 ` [PATCH 1/2] libkmod-module: check "new_from_name" return value in get_builtin Yauheni Kaliuta
2021-06-08  6:29   ` [PATCH 2/2] libkmod-builtin: consider final NIL in name length check Yauheni Kaliuta
2021-06-09 17:10     ` Lucas De Marchi
2021-06-09 17:18       ` Lucas De Marchi
2021-06-22  6:31         ` Yauheni Kaliuta
2021-06-22  6:22       ` Yauheni Kaliuta
2021-06-09 17:22   ` Lucas De Marchi [this message]

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=20210609172215.4qkrxtkbfjq3cs2u@ldmartin-desk2 \
    --to=lucas.demarchi@intel.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=ykaliuta@redhat.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).