aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-07-01 18:16:13 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-07-02 10:52:01 +0200
commitf41e1ae11b604d2146b658639d732eef61c3dbb0 (patch)
tree604009408a2746a761070b80ca92a99aebfb5090
parentf4cefcfb15003aeb43fd284ce94c4cbbbf7f4b94 (diff)
sysmobts: Fix eeprom padding before gpg key
Correct the too short padding I introduced in the commit a55b166c6c7af79cbefe8e65fe77b2d61c634d2d. The result needs to be 121 and not 120. Add static asserts to make sure it does not happen again. Change-Id: Icaaf520a280ee58c483fa64df4e447702ec746ac
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_eeprom.h2
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_par.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_eeprom.h b/src/osmo-bts-sysmo/misc/sysmobts_eeprom.h
index ecb86e1e..f49db1f5 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_eeprom.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_eeprom.h
@@ -16,7 +16,7 @@ struct sysmobts_eeprom { /* offset */
uint16_t model_flags; /* 34-35 */
uint8_t trx_nr; /* 36 */
uint8_t boot_state[48]; /* 37-84 */
- uint8_t _pad1[35]; /* 85-120 */
+ uint8_t _pad1[36]; /* 85-120 */
uint8_t gpg_key[128]; /* 121-249 */
} __attribute__((packed));
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_par.c b/src/osmo-bts-sysmo/misc/sysmobts_par.c
index 6800fded..d1fc37a2 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_par.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_par.c
@@ -19,6 +19,7 @@
*
*/
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -289,3 +290,8 @@ int sysmobts_par_set_buf(enum sysmobts_par par, const uint8_t *buf,
return len;
}
+
+osmo_static_assert(offsetof(struct sysmobts_eeprom, trx_nr) == 36, offset_36);
+osmo_static_assert(offsetof(struct sysmobts_eeprom, boot_state) == 37, offset_37);
+osmo_static_assert(offsetof(struct sysmobts_eeprom, _pad1) == 85, offset_85);
+osmo_static_assert(offsetof(struct sysmobts_eeprom, gpg_key) == 121, offset_121);