diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-01-18 06:06:01 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-17 11:57:20 -0300 |
commit | c336f75e1e822658122b96d874da01f5f4df994d (patch) | |
tree | 1e4dbbb6a4b1b4488c09aa04a6162ec35448c6ed /drivers/media/v4l2-core | |
parent | 302ab7ce2daba8cdd82a6809adb42d117a683f06 (diff) | |
download | linux-c336f75e1e822658122b96d874da01f5f4df994d.tar.gz linux-c336f75e1e822658122b96d874da01f5f4df994d.tar.bz2 linux-c336f75e1e822658122b96d874da01f5f4df994d.zip |
[media] v4l2-ctrls: return elem_size instead of strlen
When getting a string and the size given by the application is too
short return the max length the string can have (elem_size) instead
of the string length + 1. That makes more sense.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index b3ab8a974afa..e6e33b3110fa 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1332,7 +1332,7 @@ static int ptr_to_user(struct v4l2_ext_control *c, case V4L2_CTRL_TYPE_STRING: len = strlen(ptr.p_char); if (c->size < len + 1) { - c->size = len + 1; + c->size = ctrl->elem_size; return -ENOSPC; } return copy_to_user(c->string, ptr.p_char, len + 1) ? |