diff mbox series

staging: media: atomisp: Don't do unnecessary zeroing of memory

Message ID 20200909204807.36501-1-alex.dewar90@gmail.com
State Accepted
Commit e2858fa617980243a62d6b9f659bd9321220471b
Headers show
Series staging: media: atomisp: Don't do unnecessary zeroing of memory | expand

Commit Message

Alex Dewar Sept. 9, 2020, 8:48 p.m. UTC
In a few places in pci/sh_css_params.c, memset is used to zero memory
immediately before it is freed. As none of these structs appear to
contain sensitive information, just remove the calls to memset.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/staging/media/atomisp/pci/sh_css_params.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Alex Dewar Sept. 19, 2020, 7:31 p.m. UTC | #1
On 2020-09-09 21:48, Alex Dewar wrote:
> In a few places in pci/sh_css_params.c, memset is used to zero memory

> immediately before it is freed. As none of these structs appear to

> contain sensitive information, just remove the calls to memset.

Friendly ping?
>

> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>

> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>

> ---

>   drivers/staging/media/atomisp/pci/sh_css_params.c | 6 ------

>   1 file changed, 6 deletions(-)

>

> diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c

> index 2c67c23b3700..24fc497bd491 100644

> --- a/drivers/staging/media/atomisp/pci/sh_css_params.c

> +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c

> @@ -4378,7 +4378,6 @@ ia_css_3a_statistics_free(struct ia_css_3a_statistics *me)

>   	if (me) {

>   		kvfree(me->rgby_data);

>   		kvfree(me->data);

> -		memset(me, 0, sizeof(struct ia_css_3a_statistics));

>   		kvfree(me);

>   	}

>   }

> @@ -4417,7 +4416,6 @@ ia_css_dvs_statistics_free(struct ia_css_dvs_statistics *me)

>   	if (me) {

>   		kvfree(me->hor_proj);

>   		kvfree(me->ver_proj);

> -		memset(me, 0, sizeof(struct ia_css_dvs_statistics));

>   		kvfree(me);

>   	}

>   }

> @@ -4459,7 +4457,6 @@ ia_css_dvs_coefficients_free(struct ia_css_dvs_coefficients *me)

>   	if (me) {

>   		kvfree(me->hor_coefs);

>   		kvfree(me->ver_coefs);

> -		memset(me, 0, sizeof(struct ia_css_dvs_coefficients));

>   		kvfree(me);

>   	}

>   }

> @@ -4551,7 +4548,6 @@ ia_css_dvs2_statistics_free(struct ia_css_dvs2_statistics *me)

>   		kvfree(me->ver_prod.odd_imag);

>   		kvfree(me->ver_prod.even_real);

>   		kvfree(me->ver_prod.even_imag);

> -		memset(me, 0, sizeof(struct ia_css_dvs2_statistics));

>   		kvfree(me);

>   	}

>   }

> @@ -4635,7 +4631,6 @@ ia_css_dvs2_coefficients_free(struct ia_css_dvs2_coefficients *me)

>   		kvfree(me->ver_coefs.odd_imag);

>   		kvfree(me->ver_coefs.even_real);

>   		kvfree(me->ver_coefs.even_imag);

> -		memset(me, 0, sizeof(struct ia_css_dvs2_coefficients));

>   		kvfree(me);

>   	}

>   }

> @@ -4710,7 +4705,6 @@ ia_css_dvs2_6axis_config_free(struct ia_css_dvs_6axis_config *dvs_6axis_config)

>   		kvfree(dvs_6axis_config->ycoords_y);

>   		kvfree(dvs_6axis_config->xcoords_uv);

>   		kvfree(dvs_6axis_config->ycoords_uv);

> -		memset(dvs_6axis_config, 0, sizeof(struct ia_css_dvs_6axis_config));

>   		kvfree(dvs_6axis_config);

>   	}

>   }
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index 2c67c23b3700..24fc497bd491 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -4378,7 +4378,6 @@  ia_css_3a_statistics_free(struct ia_css_3a_statistics *me)
 	if (me) {
 		kvfree(me->rgby_data);
 		kvfree(me->data);
-		memset(me, 0, sizeof(struct ia_css_3a_statistics));
 		kvfree(me);
 	}
 }
@@ -4417,7 +4416,6 @@  ia_css_dvs_statistics_free(struct ia_css_dvs_statistics *me)
 	if (me) {
 		kvfree(me->hor_proj);
 		kvfree(me->ver_proj);
-		memset(me, 0, sizeof(struct ia_css_dvs_statistics));
 		kvfree(me);
 	}
 }
@@ -4459,7 +4457,6 @@  ia_css_dvs_coefficients_free(struct ia_css_dvs_coefficients *me)
 	if (me) {
 		kvfree(me->hor_coefs);
 		kvfree(me->ver_coefs);
-		memset(me, 0, sizeof(struct ia_css_dvs_coefficients));
 		kvfree(me);
 	}
 }
@@ -4551,7 +4548,6 @@  ia_css_dvs2_statistics_free(struct ia_css_dvs2_statistics *me)
 		kvfree(me->ver_prod.odd_imag);
 		kvfree(me->ver_prod.even_real);
 		kvfree(me->ver_prod.even_imag);
-		memset(me, 0, sizeof(struct ia_css_dvs2_statistics));
 		kvfree(me);
 	}
 }
@@ -4635,7 +4631,6 @@  ia_css_dvs2_coefficients_free(struct ia_css_dvs2_coefficients *me)
 		kvfree(me->ver_coefs.odd_imag);
 		kvfree(me->ver_coefs.even_real);
 		kvfree(me->ver_coefs.even_imag);
-		memset(me, 0, sizeof(struct ia_css_dvs2_coefficients));
 		kvfree(me);
 	}
 }
@@ -4710,7 +4705,6 @@  ia_css_dvs2_6axis_config_free(struct ia_css_dvs_6axis_config *dvs_6axis_config)
 		kvfree(dvs_6axis_config->ycoords_y);
 		kvfree(dvs_6axis_config->xcoords_uv);
 		kvfree(dvs_6axis_config->ycoords_uv);
-		memset(dvs_6axis_config, 0, sizeof(struct ia_css_dvs_6axis_config));
 		kvfree(dvs_6axis_config);
 	}
 }