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
ebabc32d
Commit
ebabc32d
authored
Jul 12, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jul 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: saa fix
direct write to userland pointer.
parent
cb915a90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
47 deletions
+50
-47
drivers/media/video/saa5246a.c
drivers/media/video/saa5246a.c
+50
-47
No files found.
drivers/media/video/saa5246a.c
View file @
ebabc32d
...
@@ -485,73 +485,76 @@ static inline int saa5246a_get_status(struct saa5246a_device *t,
...
@@ -485,73 +485,76 @@ static inline int saa5246a_get_status(struct saa5246a_device *t,
static
inline
int
saa5246a_get_page
(
struct
saa5246a_device
*
t
,
static
inline
int
saa5246a_get_page
(
struct
saa5246a_device
*
t
,
vtx_pagereq_t
*
req
)
vtx_pagereq_t
*
req
)
{
{
int
start
,
end
;
int
start
,
end
,
size
;
char
*
buf
;
int
err
;
if
(
req
->
pgbuf
<
0
||
req
->
pgbuf
>=
NUM_DAUS
||
if
(
req
->
pgbuf
<
0
||
req
->
pgbuf
>=
NUM_DAUS
||
req
->
start
<
0
||
req
->
start
>
req
->
end
||
req
->
end
>=
VTX_PAGESIZE
)
req
->
start
<
0
||
req
->
start
>
req
->
end
||
req
->
end
>=
VTX_PAGESIZE
)
return
-
EINVAL
;
return
-
EINVAL
;
/* Read "normal" part of page */
end
=
min
(
req
->
end
,
VTX_PAGESIZE
-
1
);
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
req
->
pgbuf
|
buf
=
kmalloc
(
VTX_PAGESIZE
,
GFP_KERNEL
);
R8_DO_NOT_CLEAR_MEMORY
,
if
(
!
buf
)
return
-
ENOMEM
;
ROW
(
req
->
start
),
/* Read "normal" part of page */
err
=
-
EIO
;
COLUMN
(
req
->
start
),
end
=
min
(
req
->
end
,
VTX_PAGESIZE
-
1
);
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
req
->
pgbuf
|
R8_DO_NOT_CLEAR_MEMORY
,
ROW
(
req
->
start
),
COLUMN
(
req
->
start
),
COMMAND_END
))
goto
out
;
if
(
i2c_getdata
(
t
,
end
-
req
->
start
+
1
,
buf
))
goto
out
;
err
=
-
EFAULT
;
if
(
copy_to_user
(
req
->
buffer
,
buf
,
end
-
req
->
start
+
1
))
goto
out
;
COMMAND_END
)
||
i2c_getdata
(
t
,
end
-
req
->
start
+
1
,
req
->
buffer
))
{
return
-
EIO
;
}
/* Always get the time from buffer 4, since this stupid SAA5246A only
/* Always get the time from buffer 4, since this stupid SAA5246A only
* updates the currently displayed buffer...
* updates the currently displayed buffer...
*/
*/
if
(
REQ_CONTAINS_TIME
(
req
))
if
(
REQ_CONTAINS_TIME
(
req
))
{
{
start
=
max
(
req
->
start
,
POS_TIME_START
);
start
=
max
(
req
->
start
,
POS_TIME_START
);
end
=
min
(
req
->
end
,
POS_TIME_END
);
end
=
min
(
req
->
end
,
POS_TIME_END
);
size
=
end
-
start
+
1
;
err
=
-
EINVAL
;
if
(
size
<
0
)
goto
out
;
err
=
-
EIO
;
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
R8_ACTIVE_CHAPTER_4
|
R8_DO_NOT_CLEAR_MEMORY
,
R8_ACTIVE_CHAPTER_4
|
R9_CURSER_ROW_0
,
start
,
COMMAND_END
))
R8_DO_NOT_CLEAR_MEMORY
,
goto
out
;
if
(
i2c_getdata
(
t
,
size
,
buf
))
R9_CURSER_ROW_0
,
goto
out
;
err
=
-
EFAULT
;
start
,
if
(
copy_to_user
(
req
->
buffer
+
start
-
req
->
start
,
buf
,
size
))
goto
out
;
COMMAND_END
)
||
i2c_getdata
(
t
,
end
-
start
+
1
,
req
->
buffer
+
start
-
req
->
start
))
{
return
-
EIO
;
}
}
}
/* Insert the header from buffer 4 only, if acquisition circuit is still searching for a page */
/* Insert the header from buffer 4 only, if acquisition circuit is still searching for a page */
if
(
REQ_CONTAINS_HEADER
(
req
)
&&
t
->
is_searching
[
req
->
pgbuf
])
if
(
REQ_CONTAINS_HEADER
(
req
)
&&
t
->
is_searching
[
req
->
pgbuf
])
{
{
start
=
max
(
req
->
start
,
POS_HEADER_START
);
start
=
max
(
req
->
start
,
POS_HEADER_START
);
end
=
min
(
req
->
end
,
POS_HEADER_END
);
end
=
min
(
req
->
end
,
POS_HEADER_END
);
size
=
end
-
start
+
1
;
err
=
-
EINVAL
;
if
(
size
<
0
)
goto
out
;
err
=
-
EIO
;
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
if
(
i2c_senddata
(
t
,
SAA5246A_REGISTER_R8
,
R8_ACTIVE_CHAPTER_4
|
R8_DO_NOT_CLEAR_MEMORY
,
R8_ACTIVE_CHAPTER_4
|
R9_CURSER_ROW_0
,
start
,
COMMAND_END
))
R8_DO_NOT_CLEAR_MEMORY
,
goto
out
;
if
(
i2c_getdata
(
t
,
end
-
start
+
1
,
buf
))
R9_CURSER_ROW_0
,
goto
out
;
err
=
-
EFAULT
;
start
,
if
(
copy_to_user
(
req
->
buffer
+
start
-
req
->
start
,
buf
,
size
))
goto
out
;
COMMAND_END
)
||
i2c_getdata
(
t
,
end
-
start
+
1
,
req
->
buffer
+
start
-
req
->
start
))
{
return
-
EIO
;
}
}
}
err
=
0
;
return
0
;
out:
kfree
(
buf
);
return
err
;
}
}
/* Stops the acquisition circuit given in dau_no. The page buffer associated
/* Stops the acquisition circuit given in dau_no. The page buffer associated
...
...
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