5e8b8e9b5549eddefbc2f502107d57a2ed7c03f4
[openwrt/staging/lynxis.git] /
1 From c6d50172818f5fdc61d561ba9124c72a2ae49718 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 13 Feb 2019 12:36:56 +0000
4 Subject: [PATCH 359/703] staging: mmal-vchiq: Always return the param size
5 from param_get
6
7 mmal-vchiq is a reimplementation of the userland library for MMAL.
8 When getting a parameter, the client provides the storage and
9 the size of the storage. The VPU then returns the size of the
10 parameter that it wished to return, and as much as possible of
11 that parameter is returned to the client.
12
13 The implementation previously only returned the size provided
14 by the VPU should it exceed the buffer size. So for parameters
15 such as the supported encodings list the client had no idea
16 how much of the provided storage had been populated.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
19 ---
20 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
24 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
25 @@ -1412,11 +1412,12 @@ static int port_parameter_get(struct vch
26 */
27 memcpy(value, &rmsg->u.port_parameter_get_reply.value,
28 *value_size);
29 - *value_size = rmsg->u.port_parameter_get_reply.size;
30 } else {
31 memcpy(value, &rmsg->u.port_parameter_get_reply.value,
32 rmsg->u.port_parameter_get_reply.size);
33 }
34 + /* Always report the size of the returned parameter to the caller */
35 + *value_size = rmsg->u.port_parameter_get_reply.size;
36
37 pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__,
38 ret, port->component->handle, port->handle, parameter_id);