aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/openpromfs/inode.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 3bd2eeccb2ad..efc7c91128af 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -64,6 +64,11 @@ static int openpromfs_readdir(struct file *, void *, filldir_t);
64static struct dentry *openpromfs_lookup(struct inode *, struct dentry *dentry, struct nameidata *nd); 64static struct dentry *openpromfs_lookup(struct inode *, struct dentry *dentry, struct nameidata *nd);
65static int openpromfs_unlink (struct inode *, struct dentry *dentry); 65static int openpromfs_unlink (struct inode *, struct dentry *dentry);
66 66
67static inline u16 ptr_nod(void *p)
68{
69 return (long)p & 0xFFFF;
70}
71
67static ssize_t nodenum_read(struct file *file, char __user *buf, 72static ssize_t nodenum_read(struct file *file, char __user *buf,
68 size_t count, loff_t *ppos) 73 size_t count, loff_t *ppos)
69{ 74{
@@ -95,9 +100,9 @@ static ssize_t property_read(struct file *filp, char __user *buf,
95 char buffer[64]; 100 char buffer[64];
96 101
97 if (!filp->private_data) { 102 if (!filp->private_data) {
98 node = nodes[(u16)((long)inode->u.generic_ip)].node; 103 node = nodes[ptr_nod(inode->u.generic_ip)].node;
99 i = ((u32)(long)inode->u.generic_ip) >> 16; 104 i = ((u32)(long)inode->u.generic_ip) >> 16;
100 if ((u16)((long)inode->u.generic_ip) == aliases) { 105 if (ptr_nod(inode->u.generic_ip) == aliases) {
101 if (i >= aliases_nodes) 106 if (i >= aliases_nodes)
102 p = NULL; 107 p = NULL;
103 else 108 else
@@ -111,7 +116,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
111 return -EIO; 116 return -EIO;
112 i = prom_getproplen (node, p); 117 i = prom_getproplen (node, p);
113 if (i < 0) { 118 if (i < 0) {
114 if ((u16)((long)inode->u.generic_ip) == aliases) 119 if (ptr_nod(inode->u.generic_ip) == aliases)
115 i = 0; 120 i = 0;
116 else 121 else
117 return -EIO; 122 return -EIO;
@@ -540,8 +545,8 @@ int property_release (struct inode *inode, struct file *filp)
540 if (!op) 545 if (!op)
541 return 0; 546 return 0;
542 lock_kernel(); 547 lock_kernel();
543 node = nodes[(u16)((long)inode->u.generic_ip)].node; 548 node = nodes[ptr_nod(inode->u.generic_ip)].node;
544 if ((u16)((long)inode->u.generic_ip) == aliases) { 549 if (ptr_nod(inode->u.generic_ip) == aliases) {
545 if ((op->flag & OPP_DIRTY) && (op->flag & OPP_STRING)) { 550 if ((op->flag & OPP_DIRTY) && (op->flag & OPP_STRING)) {
546 char *p = op->name; 551 char *p = op->name;
547 int i = (op->value - op->name) - strlen (op->name) - 1; 552 int i = (op->value - op->name) - strlen (op->name) - 1;