Blame SOURCES/0091-grub-core-io-bufio.c-grub_bufio_open-Use-grub_zalloc.patch

f96e0b
From 00e72549c724d80285041e5dac8adc310dd2c746 Mon Sep 17 00:00:00 2001
f96e0b
From: Colin Watson <cjwatson@ubuntu.com>
f96e0b
Date: Mon, 7 Jan 2013 10:45:05 +0000
f96e0b
Subject: [PATCH 091/482] * grub-core/io/bufio.c (grub_bufio_open): Use
f96e0b
 grub_zalloc instead of explicitly zeroing elements. * grub-core/io/gzio.c
f96e0b
 (grub_gzio_open): Likewise. * grub-core/io/lzopio.c (grub_lzopio_open):
f96e0b
 Remove explicit zeroing of elements in a structure already allocated using
f96e0b
 grub_zalloc. * grub-core/io/xzio.c (grub_xzio_open): Likewise.
f96e0b
f96e0b
---
f96e0b
 ChangeLog             | 9 +++++++++
f96e0b
 grub-core/io/bufio.c  | 8 ++------
f96e0b
 grub-core/io/gzio.c   | 4 +---
f96e0b
 grub-core/io/lzopio.c | 2 --
f96e0b
 grub-core/io/xzio.c   | 6 ------
f96e0b
 5 files changed, 12 insertions(+), 17 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 097ef0d..75fb85a 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,14 @@
f96e0b
 2013-01-07  Colin Watson  <cjwatson@ubuntu.com>
f96e0b
 
f96e0b
+	* grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of
f96e0b
+	explicitly zeroing elements.
f96e0b
+	* grub-core/io/gzio.c (grub_gzio_open): Likewise.
f96e0b
+	* grub-core/io/lzopio.c (grub_lzopio_open): Remove explicit zeroing
f96e0b
+	of elements in a structure already allocated using grub_zalloc.
f96e0b
+	* grub-core/io/xzio.c (grub_xzio_open): Likewise.
f96e0b
+
f96e0b
+2013-01-07  Colin Watson  <cjwatson@ubuntu.com>
f96e0b
+
f96e0b
 	* docs/grub.texi (grub_cpu): New subsection.
f96e0b
 	(grub_platform): Likewise.
f96e0b
 
f96e0b
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
f96e0b
index 2a315e2..2243827 100644
f96e0b
--- a/grub-core/io/bufio.c
f96e0b
+++ b/grub-core/io/bufio.c
f96e0b
@@ -48,7 +48,7 @@ grub_bufio_open (grub_file_t io, int size)
f96e0b
   grub_file_t file;
f96e0b
   grub_bufio_t bufio = 0;
f96e0b
 
f96e0b
-  file = (grub_file_t) grub_malloc (sizeof (*file));
f96e0b
+  file = (grub_file_t) grub_zalloc (sizeof (*file));
f96e0b
   if (! file)
f96e0b
     return 0;
f96e0b
 
f96e0b
@@ -61,7 +61,7 @@ grub_bufio_open (grub_file_t io, int size)
f96e0b
     size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE :
f96e0b
             io->size);
f96e0b
 
f96e0b
-  bufio = grub_malloc (sizeof (struct grub_bufio) + size);
f96e0b
+  bufio = grub_zalloc (sizeof (struct grub_bufio) + size);
f96e0b
   if (! bufio)
f96e0b
     {
f96e0b
       grub_free (file);
f96e0b
@@ -70,14 +70,10 @@ grub_bufio_open (grub_file_t io, int size)
f96e0b
 
f96e0b
   bufio->file = io;
f96e0b
   bufio->block_size = size;
f96e0b
-  bufio->buffer_len = 0;
f96e0b
-  bufio->buffer_at = 0;
f96e0b
 
f96e0b
   file->device = io->device;
f96e0b
-  file->offset = 0;
f96e0b
   file->size = io->size;
f96e0b
   file->data = bufio;
f96e0b
-  file->read_hook = 0;
f96e0b
   file->fs = &grub_bufio_fs;
f96e0b
   file->not_easily_seekable = io->not_easily_seekable;
f96e0b
 
f96e0b
diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
f96e0b
index 83c0b64..59f2206 100644
f96e0b
--- a/grub-core/io/gzio.c
f96e0b
+++ b/grub-core/io/gzio.c
f96e0b
@@ -1130,7 +1130,7 @@ grub_gzio_open (grub_file_t io)
f96e0b
   grub_file_t file;
f96e0b
   grub_gzio_t gzio = 0;
f96e0b
 
f96e0b
-  file = (grub_file_t) grub_malloc (sizeof (*file));
f96e0b
+  file = (grub_file_t) grub_zalloc (sizeof (*file));
f96e0b
   if (! file)
f96e0b
     return 0;
f96e0b
 
f96e0b
@@ -1144,9 +1144,7 @@ grub_gzio_open (grub_file_t io)
f96e0b
   gzio->file = io;
f96e0b
 
f96e0b
   file->device = io->device;
f96e0b
-  file->offset = 0;
f96e0b
   file->data = gzio;
f96e0b
-  file->read_hook = 0;
f96e0b
   file->fs = &grub_gzio_fs;
f96e0b
   file->not_easily_seekable = 1;
f96e0b
 
f96e0b
diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c
f96e0b
index 77291d0..7fdb6d4 100644
f96e0b
--- a/grub-core/io/lzopio.c
f96e0b
+++ b/grub-core/io/lzopio.c
f96e0b
@@ -428,9 +428,7 @@ grub_lzopio_open (grub_file_t io)
f96e0b
   lzopio->file = io;
f96e0b
 
f96e0b
   file->device = io->device;
f96e0b
-  file->offset = 0;
f96e0b
   file->data = lzopio;
f96e0b
-  file->read_hook = 0;
f96e0b
   file->fs = &grub_lzopio_fs;
f96e0b
   file->size = GRUB_FILE_SIZE_UNKNOWN;
f96e0b
   file->not_easily_seekable = 1;
f96e0b
diff --git a/grub-core/io/xzio.c b/grub-core/io/xzio.c
f96e0b
index ae30e6f..27657d8 100644
f96e0b
--- a/grub-core/io/xzio.c
f96e0b
+++ b/grub-core/io/xzio.c
f96e0b
@@ -186,12 +186,9 @@ grub_xzio_open (grub_file_t io)
f96e0b
     }
f96e0b
 
f96e0b
   xzio->file = io;
f96e0b
-  xzio->saved_offset = 0;
f96e0b
 
f96e0b
   file->device = io->device;
f96e0b
-  file->offset = 0;
f96e0b
   file->data = xzio;
f96e0b
-  file->read_hook = 0;
f96e0b
   file->fs = &grub_xzio_fs;
f96e0b
   file->size = GRUB_FILE_SIZE_UNKNOWN;
f96e0b
   file->not_easily_seekable = 1;
f96e0b
@@ -210,10 +207,7 @@ grub_xzio_open (grub_file_t io)
f96e0b
     }
f96e0b
 
f96e0b
   xzio->buf.in = xzio->inbuf;
f96e0b
-  xzio->buf.in_pos = 0;
f96e0b
-  xzio->buf.in_size = 0;
f96e0b
   xzio->buf.out = xzio->outbuf;
f96e0b
-  xzio->buf.out_pos = 0;
f96e0b
   xzio->buf.out_size = XZBUFSIZ;
f96e0b
 
f96e0b
   /* FIXME: don't test footer on not easily seekable files.  */
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b