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

a85e8e
From b9f76056507285b672cb5b3ec7317cae24863e6a Mon Sep 17 00:00:00 2001
a85e8e
From: Vladimir Serbinenko <phcoder@gmail.com>
a85e8e
Date: Fri, 4 Apr 2014 07:58:42 +0200
a85e8e
Subject: [PATCH 073/260] Replace few instances of memcmp/memcpy in the code
a85e8e
 that should be grub_memcmp/grub_memcpy.
a85e8e
a85e8e
---
a85e8e
 ChangeLog                      | 5 +++++
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 ++--
a85e8e
 5 files changed, 12 insertions(+), 7 deletions(-)
a85e8e
a85e8e
diff --git a/ChangeLog b/ChangeLog
a85e8e
index 4a484092a..f18cdba90 100644
a85e8e
--- a/ChangeLog
a85e8e
+++ b/ChangeLog
a85e8e
@@ -1,3 +1,8 @@
a85e8e
+2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
a85e8e
+
a85e8e
+	Replace few instances of memcmp/memcpy in the code that should be
a85e8e
+	grub_memcmp/grub_memcpy.
a85e8e
+
a85e8e
 2014-04-03  Vladimir Serbinenko  <phcoder@gmail.com>
a85e8e
 
a85e8e
 	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
a85e8e
diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c
a85e8e
index 09421a6c6..83bdfe1f2 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
a85e8e
index e42a9d83e..2c09fb7dd 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
a85e8e
index cb11ea5fa..f759c7f41 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
a85e8e
index 19985f03e..41ef9109e 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
       {
a85e8e
-- 
a85e8e
2.13.0
a85e8e