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

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