[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f214edb8-0af3-e1f5-8b45-9cfa0537f8b5@xs4all.nl>
Date: Thu, 3 Nov 2016 13:22:24 +0100
From: Hans Verkuil <hverkuil@...all.nl>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
linux-media@...r.kernel.org, Hans Verkuil <hans.verkuil@...co.com>,
"Lad, Prabhakar" <prabhakar.csengg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size
determination in vpfe_enum_input()
On 12/10/16 16:55, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Wed, 12 Oct 2016 10:33:42 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> drivers/media/platform/davinci/vpfe_capture.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
> index 8314c39..87ee35d 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,
> return -EINVAL;
> }
> sdinfo = &vpfe_dev->cfg->sub_devs[subdev];
> - memcpy(inp, &sdinfo->inputs[index], sizeof(struct v4l2_input));
> + memcpy(inp, &sdinfo->inputs[index], sizeof(*inp));
If I am not mistaken this can be written as:
*inp = sdinfo->inputs[index];
Much better.
Regards,
Hans
> return 0;
> }
>
>
Powered by blists - more mailing lists