From: Dmitry Antipov <dmantipov@yandex.ru>
To: linux-modules@vger.kernel.org
Cc: Dmitry Antipov <dmantipov@yandex.ru>
Subject: [PATCH] modprobe: prefer -ENODATA over -ENOENT if no section found
Date: Thu, 18 May 2023 08:47:30 +0300 [thread overview]
Message-ID: <20230518054730.11237-1-dmantipov@yandex.ru> (raw)
When the module is definitely present but CONFIG_MODVERSIONS is
disabled, the following error message may be somewhat confusing:
modprobe --dump-modversions /path/to/module.ko.xz
modprobe: FATAL: could not get modversions of /path/to/module/ko.xz: No such file or directory
Choosing among the convenient errno values, I would suggest to use ENODATA
when the module lacks a particular ELF section (and vermagic as well).
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
libkmod/libkmod-elf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c
index ef4a8a3..fb2e3d9 100644
--- a/libkmod/libkmod-elf.c
+++ b/libkmod/libkmod-elf.c
@@ -392,7 +392,7 @@ static int elf_find_section(const struct kmod_elf *elf, const char *section)
return i;
}
- return -ENOENT;
+ return -ENODATA;
}
int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size)
@@ -422,7 +422,7 @@ int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const
return 0;
}
- return -ENOENT;
+ return -ENODATA;
}
/* array will be allocated with strings in a single malloc, just free *array */
@@ -653,7 +653,7 @@ int kmod_elf_strip_vermagic(struct kmod_elf *elf)
}
ELFDBG(elf, "no vermagic found in .modinfo\n");
- return -ENOENT;
+ return -ENODATA;
}
--
2.40.1
next reply other threads:[~2023-05-18 5:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 5:47 Dmitry Antipov [this message]
2023-05-19 6:52 ` [PATCH] modprobe: prefer -ENODATA over -ENOENT if no section found Christophe Leroy
2023-05-19 7:03 ` Dmitry Antipov
2023-05-19 7:06 ` Christophe Leroy
2023-05-19 7:28 ` [PATCH] libkmod: " Dmitry Antipov
2023-05-19 9:36 ` [PATCH] libkmod, depmod: " Dmitry Antipov
2023-05-30 19:55 ` 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=20230518054730.11237-1-dmantipov@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=linux-modules@vger.kernel.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).