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

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