[PATCH v3 1/3] imd: replace magicvalue with sizeof(struct)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of using "8" as the size of an imd_header, use the sizeof operator.

Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
 common/imd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/imd.c b/common/imd.c
index 913a01de87bf..e0dab69644c0 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -41,7 +41,7 @@ const struct imd_header *imd_next(const struct imd_header *imd)
 
 	length = imd_read_length(imd);
 	length = ALIGN(length, 4);
-	length += 8;
+	length += sizeof(struct imd_header);
 
 	return (const void *)imd + length;
 }
@@ -63,14 +63,14 @@ static int imd_next_validate(const void *buf, int bufsize, int start_ofs)
 
 	size = bufsize - start_ofs;
 
-	if (size < 8) {
+	if (size < sizeof(struct imd_header)) {
 		debug("trunkated tag at offset %dd\n", start_ofs);
 		return -EINVAL;
 	}
 
 	length = imd_read_length(imd);
 	length = ALIGN(length, 4);
-	length += 8;
+	length += sizeof(struct imd_header);
 
 	if (size < length) {
 		debug("tag at offset %d with size %d exceeds bufsize %d\n",
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux