Blame SOURCES/0006-Promote-_make_hd_dn-to-make_hd_dn-and-get-rid-of-the.patch

80b73c
From bd8fc0ebe86da82468b40a4998c3000819e73afe Mon Sep 17 00:00:00 2001
80b73c
From: Peter Jones <pjones@redhat.com>
80b73c
Date: Tue, 12 Jun 2018 14:36:20 -0400
80b73c
Subject: [PATCH 06/17] Promote _make_hd_dn() to make_hd_dn() and get rid of
80b73c
 the wrapper.
80b73c
80b73c
The wrapper is just hiding what the code's doing, and all the other code
80b73c
around where we use it does the same thing anyway.  This hopefully
80b73c
convinces coverity we're not really dereferencing "buf" there unless
80b73c
it's nonzero.
80b73c
80b73c
Signed-off-by: Peter Jones <pjones@redhat.com>
80b73c
---
80b73c
 src/creator.c  | 3 ++-
80b73c
 src/disk.c     | 4 ++--
80b73c
 src/dp-media.c | 2 ++
80b73c
 src/disk.h     | 7 ++-----
80b73c
 4 files changed, 8 insertions(+), 8 deletions(-)
80b73c
80b73c
diff --git a/src/creator.c b/src/creator.c
80b73c
index 93f185fc0bc..76c1c1f7a99 100644
80b73c
--- a/src/creator.c
80b73c
+++ b/src/creator.c
80b73c
@@ -281,7 +281,8 @@ efi_va_generate_file_device_path_from_esp(uint8_t *buf, ssize_t size,
80b73c
 			goto err;
80b73c
 		}
80b73c
 
80b73c
-		sz = make_hd_dn(buf, size, off, disk_fd, dev->part, options);
80b73c
+		sz = make_hd_dn(buf+off, size?size-off:0,
80b73c
+                                disk_fd, dev->part, options);
80b73c
 		saved_errno = errno;
80b73c
 		close(disk_fd);
80b73c
 		errno = saved_errno;
80b73c
diff --git a/src/disk.c b/src/disk.c
80b73c
index deac512cf71..3efee03b804 100644
80b73c
--- a/src/disk.c
80b73c
+++ b/src/disk.c
80b73c
@@ -257,8 +257,8 @@ is_partitioned(int fd)
80b73c
 }
80b73c
 
80b73c
 ssize_t HIDDEN
80b73c
-_make_hd_dn(uint8_t *buf, ssize_t size, int fd, int32_t partition,
80b73c
-	    uint32_t options)
80b73c
+make_hd_dn(uint8_t *buf, ssize_t size, int fd, int32_t partition,
80b73c
+           uint32_t options)
80b73c
 {
80b73c
 	uint64_t part_start=0, part_size = 0;
80b73c
 	uint8_t signature[16]="", format=0, signature_type=0;
80b73c
diff --git a/src/dp-media.c b/src/dp-media.c
80b73c
index 0a0993ec3f4..cec6b8bb58d 100644
80b73c
--- a/src/dp-media.c
80b73c
+++ b/src/dp-media.c
80b73c
@@ -161,6 +161,7 @@ efidp_make_file(uint8_t *buf, ssize_t size, char *filepath)
80b73c
 	ssize_t sz;
80b73c
 	ssize_t len = utf8len(lf, -1) + 1;
80b73c
 	ssize_t req = sizeof (*file) + len * sizeof (uint16_t);
80b73c
+
80b73c
 	sz = efidp_make_generic(buf, size, EFIDP_MEDIA_TYPE, EFIDP_MEDIA_FILE,
80b73c
 				req);
80b73c
 	if (size && sz == req) {
80b73c
@@ -182,6 +183,7 @@ efidp_make_hd(uint8_t *buf, ssize_t size, uint32_t num, uint64_t part_start,
80b73c
 	efidp_hd *hd = (efidp_hd *)buf;
80b73c
 	ssize_t sz;
80b73c
 	ssize_t req = sizeof (*hd);
80b73c
+
80b73c
 	sz = efidp_make_generic(buf, size, EFIDP_MEDIA_TYPE, EFIDP_MEDIA_HD,
80b73c
 				req);
80b73c
 	if (size && sz == req) {
80b73c
diff --git a/src/disk.h b/src/disk.h
80b73c
index c040cc92a91..f0fa7f9f42d 100644
80b73c
--- a/src/disk.h
80b73c
+++ b/src/disk.h
80b73c
@@ -23,10 +23,7 @@
80b73c
 
80b73c
 extern bool HIDDEN is_partitioned(int fd);
80b73c
 
80b73c
-extern HIDDEN ssize_t _make_hd_dn(uint8_t *buf, ssize_t size, int fd,
80b73c
-                                  int32_t partition, uint32_t options);
80b73c
-#define make_hd_dn(buf, size, off, fd, partition, option) \
80b73c
-	_make_hd_dn(((buf)+(off)), ((size)?((size)-(off)):0), (fd),\
80b73c
-		    (partition), (options))
80b73c
+extern HIDDEN ssize_t make_hd_dn(uint8_t *buf, ssize_t size, int fd,
80b73c
+                                 int32_t partition, uint32_t options);
80b73c
 
80b73c
 #endif /* _EFIBOOT_DISK_H */
80b73c
-- 
80b73c
2.17.1
80b73c