Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5c31dfe3
Commit
5c31dfe3
authored
Aug 25, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Fix direct f_pos fiddling in openpromfs.
Signed-off-by:
David S. Miller
<
davem@redhat.com
>
parent
5e125db8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
fs/openpromfs/inode.c
fs/openpromfs/inode.c
+24
-24
No files found.
fs/openpromfs/inode.c
View file @
5c31dfe3
...
...
@@ -79,7 +79,7 @@ static ssize_t nodenum_read(struct file *file, char __user *buf,
count
=
9
-
file
->
f_pos
;
if
(
copy_to_user
(
buf
,
buffer
+
file
->
f_pos
,
count
))
return
-
EFAULT
;
file
->
f_
pos
+=
count
;
*
p
pos
+=
count
;
return
count
;
}
...
...
@@ -94,7 +94,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
openprom_property
*
op
;
char
buffer
[
64
];
if
(
filp
->
f_
pos
>=
0xffffff
||
count
>=
0xffffff
)
if
(
*
p
pos
>=
0xffffff
||
count
>=
0xffffff
)
return
-
EINVAL
;
if
(
!
filp
->
private_data
)
{
node
=
nodes
[(
u16
)((
long
)
inode
->
u
.
generic_ip
)].
node
;
...
...
@@ -180,7 +180,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
}
else
{
i
=
(
op
->
len
<<
1
)
+
1
;
}
k
=
filp
->
f_
pos
;
k
=
*
p
pos
;
if
(
k
>=
i
)
return
0
;
if
(
count
>
i
-
k
)
count
=
i
-
k
;
if
(
op
->
flag
&
OPP_STRING
)
{
...
...
@@ -197,7 +197,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
j
=
count
;
if
(
j
>=
0
)
{
if
(
copy_to_user
(
buf
+
k
-
filp
->
f_
pos
,
if
(
copy_to_user
(
buf
+
k
-
*
p
pos
,
op
->
value
+
k
-
1
,
j
))
return
-
EFAULT
;
count
-=
j
;
...
...
@@ -205,11 +205,11 @@ static ssize_t property_read(struct file *filp, char __user *buf,
}
if
(
count
)
{
if
(
put_user
(
'\''
,
&
buf
[
k
++
-
filp
->
f_
pos
]))
if
(
put_user
(
'\''
,
&
buf
[
k
++
-
*
p
pos
]))
return
-
EFAULT
;
}
if
(
count
>
1
)
{
if
(
put_user
(
'\n'
,
&
buf
[
k
++
-
filp
->
f_
pos
]))
if
(
put_user
(
'\n'
,
&
buf
[
k
++
-
*
p
pos
]))
return
-
EFAULT
;
}
}
else
if
(
op
->
flag
&
OPP_STRINGLIST
)
{
...
...
@@ -287,7 +287,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
if
((
k
<
i
-
1
)
&&
(
k
&
1
))
{
sprintf
(
buffer
,
"%02x"
,
(
unsigned
char
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
put_user
(
buffer
[
1
],
&
buf
[
k
++
-
filp
->
f_
pos
]))
if
(
put_user
(
buffer
[
1
],
&
buf
[
k
++
-
*
p
pos
]))
return
-
EFAULT
;
count
--
;
}
...
...
@@ -295,7 +295,7 @@ static ssize_t property_read(struct file *filp, char __user *buf,
for
(;
(
count
>
1
)
&&
(
k
<
i
-
1
);
k
+=
2
)
{
sprintf
(
buffer
,
"%02x"
,
(
unsigned
char
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
copy_to_user
(
buf
+
k
-
filp
->
f_
pos
,
buffer
,
2
))
if
(
copy_to_user
(
buf
+
k
-
*
p
pos
,
buffer
,
2
))
return
-
EFAULT
;
count
-=
2
;
}
...
...
@@ -303,18 +303,18 @@ static ssize_t property_read(struct file *filp, char __user *buf,
if
(
count
&&
(
k
<
i
-
1
))
{
sprintf
(
buffer
,
"%02x"
,
(
unsigned
char
)
*
(
op
->
value
+
(
k
>>
1
))
&
0xff
);
if
(
put_user
(
buffer
[
0
],
&
buf
[
k
++
-
filp
->
f_
pos
]))
if
(
put_user
(
buffer
[
0
],
&
buf
[
k
++
-
*
p
pos
]))
return
-
EFAULT
;
count
--
;
}
if
(
count
)
{
if
(
put_user
(
'\n'
,
&
buf
[
k
++
-
filp
->
f_
pos
]))
if
(
put_user
(
'\n'
,
&
buf
[
k
++
-
*
p
pos
]))
return
-
EFAULT
;
}
}
count
=
k
-
filp
->
f_
pos
;
filp
->
f_
pos
=
k
;
count
=
k
-
*
p
pos
;
*
p
pos
=
k
;
return
count
;
}
...
...
@@ -327,14 +327,14 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
void
*
b
;
openprom_property
*
op
;
if
(
filp
->
f_
pos
>=
0xffffff
||
count
>=
0xffffff
)
if
(
*
p
pos
>=
0xffffff
||
count
>=
0xffffff
)
return
-
EINVAL
;
if
(
!
filp
->
private_data
)
{
i
=
property_read
(
filp
,
NULL
,
0
,
NULL
);
if
(
i
)
return
i
;
}
k
=
filp
->
f_
pos
;
k
=
*
p
pos
;
op
=
(
openprom_property
*
)
filp
->
private_data
;
if
(
!
(
op
->
flag
&
OPP_STRING
))
{
u32
*
first
,
*
last
;
...
...
@@ -462,7 +462,7 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
op
->
len
=
i
;
}
else
op
->
len
=
i
;
filp
->
f_
pos
+=
count
;
*
p
pos
+=
count
;
}
write_try_string:
if
(
!
(
op
->
flag
&
OPP_BINARY
))
{
...
...
@@ -480,7 +480,7 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
op
->
flag
|=
OPP_QUOTED
;
buf
++
;
count
--
;
filp
->
f_pos
++
;
(
*
ppos
)
++
;
if
(
!
count
)
{
op
->
flag
|=
OPP_STRING
;
return
1
;
...
...
@@ -489,9 +489,9 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
op
->
flag
|=
OPP_NOTQUOTED
;
}
op
->
flag
|=
OPP_STRING
;
if
(
op
->
alloclen
<=
count
+
filp
->
f_
pos
)
{
if
(
op
->
alloclen
<=
count
+
*
p
pos
)
{
b
=
kmalloc
(
sizeof
(
openprom_property
)
+
2
*
(
count
+
filp
->
f_
pos
),
GFP_KERNEL
);
+
2
*
(
count
+
*
p
pos
),
GFP_KERNEL
);
if
(
!
b
)
return
-
ENOMEM
;
memcpy
(
b
,
filp
->
private_data
,
...
...
@@ -499,14 +499,14 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
+
strlen
(
op
->
name
)
+
op
->
alloclen
);
memset
(((
char
*
)
b
)
+
sizeof
(
openprom_property
)
+
strlen
(
op
->
name
)
+
op
->
alloclen
,
0
,
2
*
(
count
-
filp
->
f_
pos
)
-
op
->
alloclen
);
0
,
2
*
(
count
-
*
p
pos
)
-
op
->
alloclen
);
op
=
(
openprom_property
*
)
b
;
op
->
alloclen
=
2
*
(
count
+
filp
->
f_
pos
);
op
->
alloclen
=
2
*
(
count
+
*
p
pos
);
b
=
filp
->
private_data
;
filp
->
private_data
=
(
void
*
)
op
;
kfree
(
b
);
}
p
=
op
->
value
+
filp
->
f_
pos
-
((
op
->
flag
&
OPP_QUOTED
)
?
1
:
0
);
p
=
op
->
value
+
*
p
pos
-
((
op
->
flag
&
OPP_QUOTED
)
?
1
:
0
);
if
(
copy_from_user
(
p
,
buf
,
count
))
return
-
EFAULT
;
op
->
flag
|=
OPP_DIRTY
;
...
...
@@ -517,17 +517,17 @@ static ssize_t property_write(struct file *filp, const char __user *buf,
}
if
(
i
<
count
)
{
op
->
len
=
p
-
op
->
value
;
filp
->
f_
pos
+=
i
+
1
;
*
p
pos
+=
i
+
1
;
if
((
p
>
op
->
value
)
&&
(
op
->
flag
&
OPP_QUOTED
)
&&
(
*
(
p
-
1
)
==
'\''
))
op
->
len
--
;
}
else
{
if
(
p
-
op
->
value
>
op
->
len
)
op
->
len
=
p
-
op
->
value
;
filp
->
f_
pos
+=
count
;
*
p
pos
+=
count
;
}
}
return
filp
->
f_
pos
-
k
;
return
*
p
pos
-
k
;
}
int
property_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment