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
nexedi
linux
Commits
1de51f37
Commit
1de51f37
authored
Jul 24, 2002
by
Alan Cox
Committed by
Linus Torvalds
Jul 24, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] SuS/LSB compliance in readv/writev from 2.4
parent
151eb016
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
fs/read_write.c
fs/read_write.c
+13
-7
No files found.
fs/read_write.c
View file @
1de51f37
...
...
@@ -301,17 +301,23 @@ static ssize_t do_readv_writev(int type, struct file *file,
if
(
copy_from_user
(
iov
,
vector
,
count
*
sizeof
(
*
vector
)))
goto
out
;
/* BSD readv/writev returns EINVAL if one of the iov_len
values < 0 or tot_len overflowed a 32-bit integer. -ink */
/*
* Single unix specification:
* We should -EINVAL if an element length is not >= 0 and fitting an ssize_t
* The total length is fitting an ssize_t
*
* Be careful here because iov_len is a size_t not an ssize_t
*/
tot_len
=
0
;
ret
=
-
EINVAL
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
size_t
tmp
=
tot_len
;
int
len
=
iov
[
i
].
iov_len
;
if
(
len
<
0
)
s
s
ize_t
tmp
=
tot_len
;
ssize_t
len
=
(
ssize_t
)
iov
[
i
].
iov_len
;
if
(
len
<
0
)
/* size_t not fitting an ssize_t .. */
goto
out
;
(
u32
)
tot_len
+=
len
;
if
(
tot_len
<
tmp
||
tot_len
<
(
u32
)
len
)
tot_len
+=
len
;
if
(
tot_len
<
tmp
)
/* maths overflow on the ssize_t */
goto
out
;
}
...
...
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