diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-18 16:15:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-18 16:15:40 -0700 |
commit | 20bf94e266969f91c623ed8b51da4109e3f57bcb (patch) | |
tree | 4aead8959e49802b454d9c650a86ee04ae94ad47 /drivers | |
parent | 77e2782f9b683893c9341e9cf05c88b0caac7382 (diff) | |
parent | b9c54f91a48146778fe91423d4d467a0ee8c719b (diff) | |
download | linux-20bf94e266969f91c623ed8b51da4109e3f57bcb.tar.gz linux-20bf94e266969f91c623ed8b51da4109e3f57bcb.tar.bz2 linux-20bf94e266969f91c623ed8b51da4109e3f57bcb.zip |
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.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/sbus/char/openprom.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 293bb2fdb1d5..2f698763ba5d 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -145,8 +145,9 @@ static int opromgetprop(void __user *argp, struct device_node *dp, struct openpr void *pval; int len; - pval = of_get_property(dp, op->oprom_array, &len); - if (!pval || len <= 0 || len > bufsize) + if (!dp || + !(pval = of_get_property(dp, op->oprom_array, &len)) || + len <= 0 || len > bufsize) return copyout(argp, op, sizeof(int)); memcpy(op->oprom_array, pval, len); @@ -161,6 +162,8 @@ static int opromnxtprop(void __user *argp, struct device_node *dp, struct openpr struct property *prop; int len; + if (!dp) + return copyout(argp, op, sizeof(int)); if (op->oprom_array[0] == '\0') { prop = dp->properties; if (!prop) @@ -266,9 +269,13 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp static int oprompath2node(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize, DATA *data) { + phandle ph = 0; + dp = of_find_node_by_path(op->oprom_array); + if (dp) + ph = dp->node; data->current_node = dp; - *((int *)op->oprom_array) = dp->node; + *((int *)op->oprom_array) = ph; op->oprom_size = sizeof(int); return copyout(argp, op, bufsize + sizeof(int)); |