Re: [PATCH] modprobe: prefer -ENODATA over -ENOENT if no section found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Le 18/05/2023 à 07:47, Dmitry Antipov a écrit :
> [Vous ne recevez pas souvent de courriers de dmantipov@xxxxxxxxx. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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).

Fine, but can you show the text message modprobe provides with your 
change, so that we can see if the change provides a somewhat better less 
confusing message ?


> 
> Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
> ---
>   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
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux