d43c638fdc9f5436dbe269e23552571c59c5aa16
[openwrt/staging/blogic.git] /
1 From 0c0e55d9b04868733f30c348df7400fa5e6d30e2 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 353/806] 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 @@ -1413,11 +1413,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);