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

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