Blame SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Vladimir Serbinenko <phcoder@gmail.com>
a85e8e
Date: Fri, 4 Apr 2014 07:58:42 +0200
d41074
Subject: [PATCH] Replace few instances of memcmp/memcpy in the code that
d41074
 should be grub_memcmp/grub_memcpy.
a85e8e
a85e8e
---
a85e8e
 grub-core/commands/acpihalt.c  | 4 ++--
a85e8e
 grub-core/commands/legacycfg.c | 4 ++--
a85e8e
 grub-core/lib/relocator.c      | 2 +-
a85e8e
 grub-core/loader/i386/bsd.c    | 4 ++--
d41074
 ChangeLog                      | 5 +++++
a85e8e
 5 files changed, 12 insertions(+), 7 deletions(-)
a85e8e
a85e8e
diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c
d41074
index 09421a6c69d..83bdfe1f23c 100644
a85e8e
--- a/grub-core/commands/acpihalt.c
a85e8e
+++ b/grub-core/commands/acpihalt.c
a85e8e
@@ -214,8 +214,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
a85e8e
 	  }
a85e8e
 	case GRUB_ACPI_OPCODE_NAME:
a85e8e
 	  ptr++;
a85e8e
-	  if ((!scope || memcmp (scope, "\\", scope_len) == 0) &&
a85e8e
-	      (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0))
a85e8e
+	  if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) &&
a85e8e
+	      (grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0))
a85e8e
 	    {
a85e8e
 	      int ll;
a85e8e
 	      grub_uint8_t *ptr2 = ptr;
a85e8e
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
d41074
index e42a9d83ebb..2c09fb7dd78 100644
a85e8e
--- a/grub-core/commands/legacycfg.c
a85e8e
+++ b/grub-core/commands/legacycfg.c
a85e8e
@@ -580,7 +580,7 @@ check_password_md5_real (const char *entered,
a85e8e
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
a85e8e
   digest = GRUB_MD_MD5->read (ctx);
a85e8e
   GRUB_MD_MD5->final (ctx);
a85e8e
-  memcpy (alt_result, digest, MD5_HASHLEN);
a85e8e
+  grub_memcpy (alt_result, digest, MD5_HASHLEN);
a85e8e
   
a85e8e
   GRUB_MD_MD5->init (ctx);
a85e8e
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
a85e8e
@@ -596,7 +596,7 @@ check_password_md5_real (const char *entered,
a85e8e
 
a85e8e
   for (i = 0; i < 1000; i++)
a85e8e
     {
a85e8e
-      memcpy (alt_result, digest, 16);
a85e8e
+      grub_memcpy (alt_result, digest, 16);
a85e8e
 
a85e8e
       GRUB_MD_MD5->init (ctx);
a85e8e
       if ((i & 1) != 0)
a85e8e
diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
d41074
index cb11ea5fa27..f759c7f41f4 100644
a85e8e
--- a/grub-core/lib/relocator.c
a85e8e
+++ b/grub-core/lib/relocator.c
a85e8e
@@ -652,7 +652,7 @@ malloc_in_range (struct grub_relocator *rel,
a85e8e
     for (i = 0; i < (BITS_IN_BYTE * sizeof (grub_addr_t) / DIGITSORT_BITS);
a85e8e
 	 i++)
a85e8e
       {
a85e8e
-	memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0]));
a85e8e
+	grub_memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0]));
a85e8e
 	for (j = 0; j < N; j++)
a85e8e
 	  counter[((events[j].pos >> (DIGITSORT_BITS * i)) 
a85e8e
 		   & DIGITSORT_MASK) + 1]++;
a85e8e
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
d41074
index 19985f03e65..41ef9109ee1 100644
a85e8e
--- a/grub-core/loader/i386/bsd.c
a85e8e
+++ b/grub-core/loader/i386/bsd.c
a85e8e
@@ -1082,7 +1082,7 @@ grub_netbsd_add_boot_disk_and_wedge (void)
a85e8e
 
a85e8e
     grub_crypto_hash (GRUB_MD_MD5, hash,
a85e8e
 		      buf.raw, GRUB_DISK_SECTOR_SIZE);
a85e8e
-    memcpy (biw.matchhash, hash, 16);
a85e8e
+    grub_memcpy (biw.matchhash, hash, 16);
a85e8e
 
a85e8e
     grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
a85e8e
   }
a85e8e
@@ -1100,7 +1100,7 @@ grub_netbsd_add_boot_disk_and_wedge (void)
a85e8e
 	bid.labelsector = partmapsector;
a85e8e
 	bid.label.type = buf.label.type;
a85e8e
 	bid.label.checksum = buf.label.checksum;
a85e8e
-	memcpy (bid.label.packname, buf.label.packname, 16);
a85e8e
+	grub_memcpy (bid.label.packname, buf.label.packname, 16);
a85e8e
       }
a85e8e
     else
a85e8e
       {
d41074
diff --git a/ChangeLog b/ChangeLog
d41074
index 4a484092a6f..f18cdba90ce 100644
d41074
--- a/ChangeLog
d41074
+++ b/ChangeLog
d41074
@@ -1,3 +1,8 @@
d41074
+2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
d41074
+
d41074
+	Replace few instances of memcmp/memcpy in the code that should be
d41074
+	grub_memcmp/grub_memcpy.
d41074
+
d41074
 2014-04-03  Vladimir Serbinenko  <phcoder@gmail.com>
d41074
 
d41074
 	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe