[BusyBox] out of memory in insmod

John Lombardo JohnLombardo at acm.org
Mon Mar 12 20:06:53 UTC 2001


in: new_get_kernel_symbols()

	if (query_module(NULL, QM_MODULES, module_names, bufsize, &ret)) {
		if (errno == ENOSPC) {
			module_names = xrealloc(module_names, bufsize = ret);
			goto retry_modules_load;
		}
		perror_msg("QM_MODULES");
		return 0;
	}

	n_ext_modules = nmod = ret;
	ext_modules = modules = xmalloc(nmod * sizeof(*modules));
	memset(modules, 0, nmod * sizeof(*modules));

	/* Collect the modules' symbols.  */

	for (i = 0, mn = module_names, m = modules;
		...

If query_module() set the contents of ret to zero, then the xmalloc() errors
out.  It seems that simply putting the xmalloc(), memset() and for loop
inside a if (ret){} fixes the problem.

I submitted this as a patch a few days ago, but I had just joined the list,
so I'm not sure if it got out there.  If necessary, I can re-submit the
patch.

Thanks,
John Lombardo

BTW, I too am successfully running with x86+uClibc+Busybox.  Very cool.






More information about the busybox mailing list