Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC]: Fix regression in sys_getdomainname()
[OPENPROMIO]: Handle current_node being NULL correctly.

+22 -11
+6 -4
arch/sparc/kernel/sys_sparc.c
··· 470 470 { 471 471 int nlen, err; 472 472 473 - if (len < 0 || len > __NEW_UTS_LEN) 473 + if (len < 0) 474 474 return -EINVAL; 475 475 476 476 down_read(&uts_sem); 477 477 478 478 nlen = strlen(system_utsname.domainname) + 1; 479 - if (nlen < len) 480 - len = nlen; 479 + err = -EINVAL; 480 + if (nlen > len) 481 + goto out; 481 482 482 483 err = -EFAULT; 483 - if (!copy_to_user(name, system_utsname.domainname, len)) 484 + if (!copy_to_user(name, system_utsname.domainname, nlen)) 484 485 err = 0; 485 486 487 + out: 486 488 up_read(&uts_sem); 487 489 return err; 488 490 }
+6 -4
arch/sparc64/kernel/sys_sparc.c
··· 707 707 { 708 708 int nlen, err; 709 709 710 - if (len < 0 || len > __NEW_UTS_LEN) 710 + if (len < 0) 711 711 return -EINVAL; 712 712 713 713 down_read(&uts_sem); 714 714 715 715 nlen = strlen(system_utsname.domainname) + 1; 716 - if (nlen < len) 717 - len = nlen; 716 + err = -EINVAL; 717 + if (nlen > len) 718 + goto out; 718 719 719 720 err = -EFAULT; 720 - if (!copy_to_user(name, system_utsname.domainname, len)) 721 + if (!copy_to_user(name, system_utsname.domainname, nlen)) 721 722 err = 0; 722 723 724 + out: 723 725 up_read(&uts_sem); 724 726 return err; 725 727 }
+10 -3
drivers/sbus/char/openprom.c
··· 145 145 void *pval; 146 146 int len; 147 147 148 - pval = of_get_property(dp, op->oprom_array, &len); 149 - if (!pval || len <= 0 || len > bufsize) 148 + if (!dp || 149 + !(pval = of_get_property(dp, op->oprom_array, &len)) || 150 + len <= 0 || len > bufsize) 150 151 return copyout(argp, op, sizeof(int)); 151 152 152 153 memcpy(op->oprom_array, pval, len); ··· 162 161 struct property *prop; 163 162 int len; 164 163 164 + if (!dp) 165 + return copyout(argp, op, sizeof(int)); 165 166 if (op->oprom_array[0] == '\0') { 166 167 prop = dp->properties; 167 168 if (!prop) ··· 269 266 270 267 static int oprompath2node(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize, DATA *data) 271 268 { 269 + phandle ph = 0; 270 + 272 271 dp = of_find_node_by_path(op->oprom_array); 272 + if (dp) 273 + ph = dp->node; 273 274 data->current_node = dp; 274 - *((int *)op->oprom_array) = dp->node; 275 + *((int *)op->oprom_array) = ph; 275 276 op->oprom_size = sizeof(int); 276 277 277 278 return copyout(argp, op, bufsize + sizeof(int));