-+ if (mach->mach_name[0])
-+ strncpy(mips_machine_name, mach->mach_name,
-+ MIPS_MACHINE_NAME_LEN);
++ if (mach->mach_name) {
++ char *name;
++ unsigned int len;
++
++ len = strlen(mach->mach_name);
++ name = kmalloc(len + 1, GFP_KERNEL);
++ if (name) {
++ strncpy(name, mach->mach_name,len);
++ name[len] = '\0';
++ mips_machine_name = name;
++ } else {
++ printk(KERN_WARNING "MIPS: no memory for machine_name\n");
++ }
++ }