On Thursday 02 April 2009 00:04, Guenter wrote:
> please take a look at attached patch; this seems to work almost for me =
> means that insmod as well as modprobe load gzip'd as well as
> non-compressed modules fine, but currently I see another prob regarding
> dependencies, but I guess this is a separate prob with moddep stuff...
> 
> attached patch is a diff -u against modutils-24.c from current svn
> trunk; it does not yet patch obj_load_progbits() since there another
> function for loading is used, and was unsure if I can replace there in
> same way as I did in obj_load(); also I want to hear your comments first
> if my patch is what you expect to see...


> -static struct obj_file *obj_load(int fd, int loadprogbits UNUSED_PARAM)
> +static struct obj_file *obj_load(void *memimg, size_t memimg_size, int
> loadprogbits UNUSED_PARAM)

Patch is damaged by linewrapping.
Please send as attachment next time, not inline.



> -     xlseek(fd, f->header.e_shoff, SEEK_SET);
> -     xread(fd, section_headers, sizeof(ElfW(Shdr)) * shnum);
> +     if (memimg_size < (f->header.e_shoff + sizeof(ElfW(Shdr)) * shnum))

bug in the line above.

> +             bb_error_msg_and_die("loaded memory image seems too small");
> +     memcpy(section_headers, memimg + f->header.e_shoff, sizeof(ElfW(Shdr))



> -     fd = open_or_warn(m_filename, O_RDONLY);
> -     if (fd < 0)
> +
> +     if (strstr(m_filename, ".gz"))

bug. "module.gzopled.ko" is not a gzip file, yet will be detected as one.

> +             m_image = xmalloc_open_zipped_read_close(m_filename, &len);
> +     else
> +             m_image = xmalloc_open_read_close(m_filename, &len);
> +     if (!m_image)
>               return EXIT_FAILURE;

Why do you do it this way at all? Can this work instead? -

size_t len = MAXINT(ssize_t);
void *image = xmalloc_open_zipped_read_close(filename, &len);



>       m_name = xstrdup(bb_basename(m_filename));
> -     p = strrchr(m_name, '.');
> +     p = strchr(m_name, '.');

Why?

--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to