diff options
author | Steffen Trumtrar <s.trumtrar@pengutronix.de> | 2020-01-27 15:51:49 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-01-28 09:21:11 +0100 |
commit | 3b27a6eecb5bb6089b490258a54e7873aacf6573 (patch) | |
tree | 4bdc80045c220ce392f8d7f2043221dc9f2c77f4 /common/imd.c | |
parent | ee8960aec018df2ded4ac28776243bda0b633d67 (diff) | |
download | barebox-3b27a6eecb5bb6089b490258a54e7873aacf6573.tar.gz barebox-3b27a6eecb5bb6089b490258a54e7873aacf6573.tar.xz |
imd: replace magicvalue with sizeof(struct)
Instead of using "8" as the size of an imd_header, use the sizeof operator.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/imd.c')
-rw-r--r-- | common/imd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/imd.c b/common/imd.c index 913a01de87..e0dab69644 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", |