diff options
author | Martin Habets | 2006-05-12 21:53:59 +0200 |
---|---|---|
committer | David S. Miller | 2006-05-12 21:53:59 +0200 |
commit | 586152560ae8df2a9babf1a8b667d7a145cb8208 (patch) | |
tree | 18c02fc0987e4f42ea6ab212b01caebfda49be80 /drivers/sbus/char | |
parent | [SPARC]: Handle UNWIND_INFO properly. (diff) | |
download | kernel-qcow2-linux-586152560ae8df2a9babf1a8b667d7a145cb8208.tar.gz kernel-qcow2-linux-586152560ae8df2a9babf1a8b667d7a145cb8208.tar.xz kernel-qcow2-linux-586152560ae8df2a9babf1a8b667d7a145cb8208.zip |
[SPARC]: Fix warning on prom_getproperty in openprom.c
Signed-off-by: Martin Habets <errandir_news@mph.eclipse.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/sbus/char')
-rw-r--r-- | drivers/sbus/char/openprom.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 383a95f34a0d..239e108b8ed1 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -392,13 +392,16 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, return -ENOMEM; } - prom_getproperty(op.op_nodeid, str, tmp, len); - - tmp[len] = '\0'; + cnt = prom_getproperty(op.op_nodeid, str, tmp, len); + if (cnt <= 0) { + error = -EINVAL; + } else { + tmp[len] = '\0'; - if (__copy_to_user(argp, &op, sizeof(op)) != 0 - || copy_to_user(op.op_buf, tmp, len) != 0) - error = -EFAULT; + if (__copy_to_user(argp, &op, sizeof(op)) != 0 || + copy_to_user(op.op_buf, tmp, len) != 0) + error = -EFAULT; + } kfree(tmp); kfree(str); |