fix bug 3223 (parameter loading problem for 2.4 kernels)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-02-13 04:17:35 +01:00
parent 9a5b7f636d
commit 07cda2268a

View File

@ -2444,14 +2444,12 @@ new_process_module_arguments(struct obj_file *f, const char *options)
bb_error_msg_and_die("symbol for parameter %s not found", param); bb_error_msg_and_die("symbol for parameter %s not found", param);
/* Number of parameters */ /* Number of parameters */
min = max = 1;
if (isdigit(*pinfo)) { if (isdigit(*pinfo)) {
min = strtoul(pinfo, &pinfo, 10); min = max = strtoul(pinfo, &pinfo, 10);
if (*pinfo == '-') if (*pinfo == '-')
max = strtoul(pinfo + 1, &pinfo, 10); max = strtoul(pinfo + 1, &pinfo, 10);
else }
max = min;
} else
min = max = 1;
contents = f->sections[sym->secidx]->contents; contents = f->sections[sym->secidx]->contents;
loc = contents + sym->value; loc = contents + sym->value;
@ -2473,7 +2471,8 @@ new_process_module_arguments(struct obj_file *f, const char *options)
/* Parse parameter values */ /* Parse parameter values */
n = 0; n = 0;
p = val; p = val;
while (*p != 0) { while (*p) {
char sv_ch;
char *endp; char *endp;
if (++n > max) if (++n > max)
@ -2482,21 +2481,25 @@ new_process_module_arguments(struct obj_file *f, const char *options)
switch (*pinfo) { switch (*pinfo) {
case 's': case 's':
len = strcspn(p, ","); len = strcspn(p, ",");
p[len] = 0; sv_ch = p[len];
p[len] = '\0';
obj_string_patch(f, sym->secidx, obj_string_patch(f, sym->secidx,
loc - contents, p); loc - contents, p);
loc += tgt_sizeof_char_p; loc += tgt_sizeof_char_p;
p += len; p += len;
*p = sv_ch;
break; break;
case 'c': case 'c':
len = strcspn(p, ","); len = strcspn(p, ",");
p[len] = 0; sv_ch = p[len];
p[len] = '\0';
if (len >= charssize) if (len >= charssize)
bb_error_msg_and_die("string too long for %s (max %ld)", param, bb_error_msg_and_die("string too long for %s (max %ld)", param,
charssize - 1); charssize - 1);
strcpy((char *) loc, p); strcpy((char *) loc, p);
loc += charssize; loc += charssize;
p += len; p += len;
*p = sv_ch;
break; break;
case 'b': case 'b':
*loc++ = strtoul(p, &endp, 0); *loc++ = strtoul(p, &endp, 0);