Skip to content

Commit

Permalink
[SPARC]: Fix warning on prom_getproperty in openprom.c
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Habets <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Martin Habets authored and davem330 committed May 12, 2006
1 parent 06a1be1 commit 5861525
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/sbus/char/openprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5861525

Please sign in to comment.