Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_core
Commits
6e6140e0
Commit
6e6140e0
authored
11 years ago
by
JP Abgrall
Committed by
Android Git Automerger
11 years ago
Browse files
Options
Download
Plain Diff
am
f7cf1a06
: Merge "sdcard: direct I/O file access fix"
* commit '
f7cf1a06
': sdcard: direct I/O file access fix
parents
2bcf2437
f7cf1a06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
sdcard/sdcard.c
sdcard/sdcard.c
+5
-4
No files found.
sdcard/sdcard.c
View file @
6e6140e0
...
...
@@ -232,7 +232,7 @@ struct fuse_handler {
* buffer at the same time. This allows us to share the underlying storage. */
union
{
__u8
request_buffer
[
MAX_REQUEST_SIZE
];
__u8
read_buffer
[
MAX_READ
];
__u8
read_buffer
[
MAX_READ
+
PAGESIZE
];
};
};
...
...
@@ -1218,6 +1218,7 @@ static int handle_read(struct fuse* fuse, struct fuse_handler* handler,
__u32
size
=
req
->
size
;
__u64
offset
=
req
->
offset
;
int
res
;
__u8
*
read_buffer
=
(
__u8
*
)
((
uintptr_t
)(
handler
->
read_buffer
+
PAGESIZE
)
&
~
((
uintptr_t
)
PAGESIZE
-
1
));
/* Don't access any other fields of hdr or req beyond this point, the read buffer
* overlaps the request buffer and will clobber data in the request. This
...
...
@@ -1225,14 +1226,14 @@ static int handle_read(struct fuse* fuse, struct fuse_handler* handler,
TRACE
(
"[%d] READ %p(%d) %u@%llu
\n
"
,
handler
->
token
,
h
,
h
->
fd
,
size
,
offset
);
if
(
size
>
sizeof
(
handler
->
read_buffer
)
)
{
if
(
size
>
MAX_READ
)
{
return
-
EINVAL
;
}
res
=
pread64
(
h
->
fd
,
handler
->
read_buffer
,
size
,
offset
);
res
=
pread64
(
h
->
fd
,
read_buffer
,
size
,
offset
);
if
(
res
<
0
)
{
return
-
errno
;
}
fuse_reply
(
fuse
,
unique
,
handler
->
read_buffer
,
res
);
fuse_reply
(
fuse
,
unique
,
read_buffer
,
res
);
return
NO_STATUS
;
}
...
...
This diff is collapsed.
Click to expand it.
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