[syslinux:syslinux-4.xx] acpi: Removing memset of buffer

syslinux-bot for Erwan Velu erwan at enovance.com
Sat Feb 1 05:00:03 PST 2014


Commit-ID:  003a288a03c2384bd42b36edbe3bf13714f84700
Gitweb:     http://www.syslinux.org/commit/003a288a03c2384bd42b36edbe3bf13714f84700
Author:     Erwan Velu <erwan at enovance.com>
AuthorDate: Wed, 29 Jan 2014 20:28:08 +0100
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 1 Feb 2014 07:59:33 -0500

acpi: Removing memset of buffer

There is no need to memset the buffer since the strncat will end the
string with a \0. The memset was also almost wrong as doing a sizeof()
on a char * could return 1 if buff was malloc'ed.

We had chance as all the current calls are done with static buffers.

Removing this memset call will make things clearer but also will prevent
compilation warnings like :

com32/gpllib/acpi/acpi.c:38:29: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the
destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
     memset(buffer, 0, sizeof(buffer));

---
 com32/gpllib/acpi/acpi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index d2bf29e..3013f19 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -35,7 +35,6 @@
 /* M1PS flags have to be interpreted as strings */
 char *flags_to_string(char *buffer, uint16_t flags)
 {
-    memset(buffer, 0, sizeof(buffer));
     strcpy(buffer, "default");
     if ((flags & POLARITY_ACTIVE_HIGH) == POLARITY_ACTIVE_HIGH)
 	strcpy(buffer, "high");


More information about the Syslinux-commits mailing list