2018-11-24 15:36:33

by David CARLIER

[permalink] [raw]
Subject: [PATCH] Little memset_explicit optimisation

Subject: [PATCH] memzero_explicit, optimisation for size.


Using the return value of memset for save/load sake.


Signed-off-by: David Carlier <[email protected]>

---

lib/string.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/lib/string.c b/lib/string.c

index 38e4ca08e757..92da04a0213b 100644

--- a/lib/string.c

+++ b/lib/string.c

@@ -720,7 +720,7 @@ EXPORT_SYMBOL(memset);

*/

void memzero_explicit(void *s, size_t count)

{

- memset(s, 0, count);

+ s = memset(s, 0, count);

barrier_data(s);

}

EXPORT_SYMBOL(memzero_explicit);

--

2.19.1


2018-11-26 11:34:36

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] Little memset_explicit optimisation

On Sat, Nov 24, 2018 at 03:35:05PM +0000, David CARLIER wrote:
> Subject: [PATCH] memzero_explicit, optimisation for size.
>
>
> Using the return value of memset for save/load sake.


It's mangled, you, perhaps, need to use

`git format-patch ...; git send-email ...`

for sake of correctness.

On top of that, same comment as per previous attempt.
Btw, you need to use versioning (hint: `git format-patch -v ` IIRC).

>
>
> Signed-off-by: David Carlier <[email protected]>
>
> ---
>
> lib/string.c | 2 +-
>
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> diff --git a/lib/string.c b/lib/string.c
>
> index 38e4ca08e757..92da04a0213b 100644
>
> --- a/lib/string.c
>
> +++ b/lib/string.c
>
> @@ -720,7 +720,7 @@ EXPORT_SYMBOL(memset);
>
> */
>
> void memzero_explicit(void *s, size_t count)
>
> {
>
> - memset(s, 0, count);
>
> + s = memset(s, 0, count);
>
> barrier_data(s);
>
> }
>
> EXPORT_SYMBOL(memzero_explicit);
>
> --
>
> 2.19.1

--
With Best Regards,
Andy Shevchenko



2018-11-28 06:35:14

by David CARLIER

[permalink] [raw]
Subject: Re: [PATCH] Little memset_explicit optimisation

Bad entrance with bad idea I m afraid :-) sorry for the noise.

2018-11-28 07:03:40

by Joey Pabalinas

[permalink] [raw]
Subject: Re: [PATCH] Little memset_explicit optimisation

On Wed, Nov 28, 2018 at 06:32:27AM +0000, David CARLIER wrote:
> Bad entrance with bad idea I m afraid :-) sorry for the noise.

We all start somewhere, no worries :)

--
Cheers,
Joey Pabalinas


Attachments:
(No filename) (203.00 B)
signature.asc (849.00 B)
Download all attachments