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
19e4e57a
Commit
19e4e57a
authored
Jun 03, 2003
by
Christoph Hellwig
Committed by
David S. Miller
Jun 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Fix coding style in net/core/iovec.c
parent
4cb5e616
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
82 deletions
+58
-82
net/core/iovec.c
net/core/iovec.c
+58
-82
No files found.
net/core/iovec.c
View file @
19e4e57a
...
...
@@ -41,35 +41,35 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
{
int
size
,
err
,
ct
;
if
(
m
->
msg_namelen
)
{
if
(
mode
==
VERIFY_READ
)
{
err
=
move_addr_to_kernel
(
m
->
msg_name
,
m
->
msg_namelen
,
address
);
if
(
err
<
0
)
goto
out
;
}
if
(
m
->
msg_namelen
)
{
if
(
mode
==
VERIFY_READ
)
{
err
=
move_addr_to_kernel
(
m
->
msg_name
,
m
->
msg_namelen
,
address
);
if
(
err
<
0
)
return
err
;
m
->
msg_name
=
address
;
}
else
m
->
msg_name
=
NULL
;
}
err
=
-
EFAULT
;
size
=
m
->
msg_iovlen
*
sizeof
(
struct
iovec
);
if
(
copy_from_user
(
iov
,
m
->
msg_iov
,
size
))
goto
out
;
m
->
msg_iov
=
iov
;
return
-
EFAULT
;
m
->
msg_iov
=
iov
;
err
=
0
;
for
(
err
=
0
,
ct
=
0
;
ct
<
m
->
msg_iovlen
;
ct
++
)
{
for
(
ct
=
0
;
ct
<
m
->
msg_iovlen
;
ct
++
)
{
err
+=
iov
[
ct
].
iov_len
;
/* Goal is not to verify user data, but to prevent returning
negative value, which is interpreted as errno.
Overflow is still possible, but it is harmless.
/*
* Goal is not to verify user data, but to prevent returning
* negative value, which is interpreted as errno.
* Overflow is still possible, but it is harmless.
*/
if
(
err
<
0
)
return
-
EMSGSIZE
;
}
out:
return
err
;
}
...
...
@@ -81,25 +81,20 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
int
memcpy_toiovec
(
struct
iovec
*
iov
,
unsigned
char
*
kdata
,
int
len
)
{
int
err
=
-
EFAULT
;
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
int
copy
=
min_t
(
unsigned
int
,
iov
->
iov_len
,
len
);
if
(
copy_to_user
(
iov
->
iov_base
,
kdata
,
copy
))
goto
out
;
kdata
+=
copy
;
len
-=
copy
;
iov
->
iov_len
-=
copy
;
iov
->
iov_base
+=
copy
;
return
-
EFAULT
;
kdata
+=
copy
;
len
-=
copy
;
iov
->
iov_len
-=
copy
;
iov
->
iov_base
+=
copy
;
}
iov
++
;
}
err
=
0
;
out:
return
err
;
return
0
;
}
/*
...
...
@@ -110,16 +105,14 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
void
memcpy_tokerneliovec
(
struct
iovec
*
iov
,
unsigned
char
*
kdata
,
int
len
)
{
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
int
copy
=
min_t
(
unsigned
int
,
iov
->
iov_len
,
len
);
memcpy
(
iov
->
iov_base
,
kdata
,
copy
);
kdata
+=
copy
;
len
-=
copy
;
iov
->
iov_len
-=
copy
;
iov
->
iov_base
+=
copy
;
kdata
+=
copy
;
len
-=
copy
;
iov
->
iov_len
-=
copy
;
iov
->
iov_base
+=
copy
;
}
iov
++
;
}
...
...
@@ -134,59 +127,47 @@ void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len)
int
memcpy_fromiovec
(
unsigned
char
*
kdata
,
struct
iovec
*
iov
,
int
len
)
{
int
err
=
-
EFAULT
;
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
while
(
len
>
0
)
{
if
(
iov
->
iov_len
)
{
int
copy
=
min_t
(
unsigned
int
,
len
,
iov
->
iov_len
);
if
(
copy_from_user
(
kdata
,
iov
->
iov_base
,
copy
))
goto
out
;
len
-=
copy
;
kdata
+=
copy
;
iov
->
iov_base
+=
copy
;
iov
->
iov_len
-=
copy
;
return
-
EFAULT
;
len
-=
copy
;
kdata
+=
copy
;
iov
->
iov_base
+=
copy
;
iov
->
iov_len
-=
copy
;
}
iov
++
;
}
err
=
0
;
out:
return
err
;
}
return
0
;
}
/*
* For use with ip_build_xmit
*/
int
memcpy_fromiovecend
(
unsigned
char
*
kdata
,
struct
iovec
*
iov
,
int
offset
,
int
len
)
{
int
err
=
-
EFAULT
;
/* Skip over the finished iovecs */
while
(
offset
>=
iov
->
iov_len
)
{
while
(
offset
>=
iov
->
iov_len
)
{
offset
-=
iov
->
iov_len
;
iov
++
;
}
while
(
len
>
0
)
{
while
(
len
>
0
)
{
u8
*
base
=
iov
->
iov_base
+
offset
;
int
copy
=
min_t
(
unsigned
int
,
len
,
iov
->
iov_len
-
offset
);
offset
=
0
;
if
(
copy_from_user
(
kdata
,
base
,
copy
))
goto
out
;
return
-
EFAULT
;
len
-=
copy
;
kdata
+=
copy
;
iov
++
;
}
err
=
0
;
out:
return
err
;
return
0
;
}
/*
...
...
@@ -197,7 +178,6 @@ int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
* ip_build_xmit must ensure that when fragmenting only the last
* call to this function will be unaligned also.
*/
int
csum_partial_copy_fromiovecend
(
unsigned
char
*
kdata
,
struct
iovec
*
iov
,
int
offset
,
unsigned
int
len
,
int
*
csump
)
{
...
...
@@ -205,21 +185,19 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
int
partial_cnt
=
0
,
err
=
0
;
/* Skip over the finished iovecs */
while
(
offset
>=
iov
->
iov_len
)
{
while
(
offset
>=
iov
->
iov_len
)
{
offset
-=
iov
->
iov_len
;
iov
++
;
}
while
(
len
>
0
)
{
while
(
len
>
0
)
{
u8
*
base
=
iov
->
iov_base
+
offset
;
int
copy
=
min_t
(
unsigned
int
,
len
,
iov
->
iov_len
-
offset
);
offset
=
0
;
/* There is a remnant from previous iov. */
if
(
partial_cnt
)
{
if
(
partial_cnt
)
{
int
par_len
=
4
-
partial_cnt
;
/* iov component is too short ... */
...
...
@@ -247,11 +225,9 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
partial_cnt
=
0
;
}
if
(
len
>
copy
)
{
if
(
len
>
copy
)
{
partial_cnt
=
copy
%
4
;
if
(
partial_cnt
)
{
if
(
partial_cnt
)
{
copy
-=
partial_cnt
;
if
(
copy_from_user
(
kdata
+
copy
,
base
+
copy
,
partial_cnt
))
...
...
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