diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-vbi.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-vbi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index 7275f2d6597e..2dfa957b0fd5 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -157,24 +157,30 @@ static void ivtv_write_vbi(struct ivtv *itv, | |||
157 | ivtv_write_vbi_cc_lines(itv, &cc); | 157 | ivtv_write_vbi_cc_lines(itv, &cc); |
158 | } | 158 | } |
159 | 159 | ||
160 | void ivtv_write_vbi_from_user(struct ivtv *itv, | 160 | ssize_t |
161 | const struct v4l2_sliced_vbi_data __user *sliced, | 161 | ivtv_write_vbi_from_user(struct ivtv *itv, |
162 | size_t cnt) | 162 | const struct v4l2_sliced_vbi_data __user *sliced, |
163 | size_t cnt) | ||
163 | { | 164 | { |
164 | struct vbi_cc cc = { .odd = { 0x80, 0x80 }, .even = { 0x80, 0x80 } }; | 165 | struct vbi_cc cc = { .odd = { 0x80, 0x80 }, .even = { 0x80, 0x80 } }; |
165 | int found_cc = 0; | 166 | int found_cc = 0; |
166 | size_t i; | 167 | size_t i; |
167 | struct v4l2_sliced_vbi_data d; | 168 | struct v4l2_sliced_vbi_data d; |
169 | ssize_t ret = cnt * sizeof(struct v4l2_sliced_vbi_data); | ||
168 | 170 | ||
169 | for (i = 0; i < cnt; i++) { | 171 | for (i = 0; i < cnt; i++) { |
170 | if (copy_from_user(&d, sliced + i, | 172 | if (copy_from_user(&d, sliced + i, |
171 | sizeof(struct v4l2_sliced_vbi_data))) | 173 | sizeof(struct v4l2_sliced_vbi_data))) { |
174 | ret = -EFAULT; | ||
172 | break; | 175 | break; |
176 | } | ||
173 | ivtv_write_vbi_line(itv, sliced + i, &cc, &found_cc); | 177 | ivtv_write_vbi_line(itv, sliced + i, &cc, &found_cc); |
174 | } | 178 | } |
175 | 179 | ||
176 | if (found_cc) | 180 | if (found_cc) |
177 | ivtv_write_vbi_cc_lines(itv, &cc); | 181 | ivtv_write_vbi_cc_lines(itv, &cc); |
182 | |||
183 | return ret; | ||
178 | } | 184 | } |
179 | 185 | ||
180 | static void copy_vbi_data(struct ivtv *itv, int lines, u32 pts_stamp) | 186 | static void copy_vbi_data(struct ivtv *itv, int lines, u32 pts_stamp) |