Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1514482 > unrolled thread

Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()

Started byHans Verkuil <hverkuil@xs4all.nl>
First post2016-11-03 13:30 +0100
Last post2016-11-06 22:10 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_enum_input() Hans Verkuil <hverkuil@xs4all.nl> - 2016-11-03 13:30 +0100
    Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_enum_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-11-03 22:10 +0100
      Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_enum_input() Hans Verkuil <hverkuil@xs4all.nl> - 2016-11-04 09:10 +0100
        [PATCH v2 17/34] [media] DaVinci-VPFE-Capture: Replace a memcpy()  call by an assignment in vpfe_enum_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-11-06 22:10 +0100

#1514482 — Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()

FromHans Verkuil <hverkuil@xs4all.nl>
Date2016-11-03 13:30 +0100
SubjectRe: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
Message-ID<szpjz-3NI-33@gated-at.bofh.it>
On 12/10/16 16:55, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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;
>  }
>
>

[toc] | [next] | [standalone]


#1514841

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-11-03 22:10 +0100
Message-ID<szxqO-KH-17@gated-at.bofh.it>
In reply to#1514482
>> @@ -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.

At which position would you like to integrate a second approach for such a change
from this patch series?

* Do you expect me to send a "V2" for the whole series?

* Will an update step be appropriate if I would rebase it on other
  recently accepted suggestions?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1515065

FromHans Verkuil <hverkuil@xs4all.nl>
Date2016-11-04 09:10 +0100
Message-ID<szHJv-7wH-11@gated-at.bofh.it>
In reply to#1514841
On 03/11/16 22:05, SF Markus Elfring wrote:
>>> @@ -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.
>
> At which position would you like to integrate a second approach for such a change
> from this patch series?
>
> * Do you expect me to send a "V2" for the whole series?

No, just for the patches I commented upon.

>
> * Will an update step be appropriate if I would rebase it on other
>   recently accepted suggestions?

You can base it on 
https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=for-v4.10a

That branch has all your other patches of this series merged and is part 
of a pull
request I posted yesterday.

	Hans

>
> Regards,
> Markus
>

[toc] | [prev] | [next] | [standalone]


#1515773 — [PATCH v2 17/34] [media] DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment in vpfe_enum_input()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-11-06 22:10 +0100
Subject[PATCH v2 17/34] [media] DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment in vpfe_enum_input()
Message-ID<sACRr-28C-7@gated-at.bofh.it>
In reply to#1515065
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 6 Nov 2016 21:54:38 +0100

Use a direct assignment for an array element which can be set over the
pointer variable "inp" instead of calling the function "memcpy" here.

Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Markus Elfring <elfring@users.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..5417f6b 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));
+	*inp = sdinfo->inputs[index];
 	return 0;
 }
 
-- 
2.10.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web