[v2,05/20] EDAC, mc: Remove needless zero string termination

Message ID 20191106093239.25517-6-rrichter@marvell.com
State New
Headers show
Series
  • EDAC: Rework edac_mc and ghes drivers
Related show

Commit Message

Robert Richter Nov. 6, 2019, 9:33 a.m.
Since this is a string already and strlen() has been used to advance
the pointer, the end of the buffer is already zero terminated. Remove
the needless zero string termination.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Robert Richter <rrichter@marvell.com>

---
 drivers/edac/edac_mc.c | 1 -
 1 file changed, 1 deletion(-)

-- 
2.20.1

Comments

Mauro Carvalho Chehab Nov. 9, 2019, 7:28 a.m. | #1
Em Wed, 6 Nov 2019 09:33:11 +0000
Robert Richter <rrichter@marvell.com> escreveu:

> Since this is a string already and strlen() has been used to advance

> the pointer, the end of the buffer is already zero terminated. Remove

> the needless zero string termination.

> 

> Suggested-by: Joe Perches <joe@perches.com>

> Signed-off-by: Robert Richter <rrichter@marvell.com>


Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---

>  drivers/edac/edac_mc.c | 1 -

>  1 file changed, 1 deletion(-)

> 

> diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c

> index f2cbca77bc50..8bfe76d1bdf1 100644

> --- a/drivers/edac/edac_mc.c

> +++ b/drivers/edac/edac_mc.c

> @@ -1183,7 +1183,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,

>  			}

>  			strcpy(p, dimm->label);

>  			p += strlen(p);

> -			*p = '\0';

>  

>  			/*

>  			 * get csrow/channel of the DIMM, in order to allow





Cheers,
Mauro
Borislav Petkov Nov. 9, 2019, 10:11 a.m. | #2
On Wed, Nov 06, 2019 at 09:33:11AM +0000, Robert Richter wrote:
> Since this is a string already and strlen() has been used to advance

> the pointer, the end of the buffer is already zero terminated. Remove

> the needless zero string termination.


Changed that to:

"The e string to which this is pointing to has already been cleared
earlier in the function so remove the needless zero string termination."

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Patch

diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index f2cbca77bc50..8bfe76d1bdf1 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -1183,7 +1183,6 @@  void edac_mc_handle_error(const enum hw_event_mc_err_type type,
 			}
 			strcpy(p, dimm->label);
 			p += strlen(p);
-			*p = '\0';
 
 			/*
 			 * get csrow/channel of the DIMM, in order to allow