summaryrefslogtreecommitdiff
path: root/package/cfgfs/src
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2013-10-17 18:19:59 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2013-10-17 18:19:59 +0200
commite4938d7ddd08016bfd4cff81994a8c7d762d6d50 (patch)
treefcef46443f8bab6f40e120b1103851a6c588212a /package/cfgfs/src
parentcc5d4d9393159133f3d5d6205cafc148cdd95945 (diff)
check for maximum of 16 MB cfgfs partition, more is not available by design, thx @tg for the info
Diffstat (limited to 'package/cfgfs/src')
-rw-r--r--package/cfgfs/src/defs.h2
-rw-r--r--package/cfgfs/src/wraps.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/package/cfgfs/src/defs.h b/package/cfgfs/src/defs.h
index c099ffb5a..5a70d8c14 100644
--- a/package/cfgfs/src/defs.h
+++ b/package/cfgfs/src/defs.h
@@ -10,7 +10,7 @@
#define DEFS_H
#define DEF_FLASHBLOCK 65536 /* size of a flash block */
-#define DEF_FLASHPART 4194304 /* max size of the partition */
+#define DEF_FLASHPART 16777215 /* max size of the partition */
#define FWCF_VER 0x01 /* major version of spec used */
diff --git a/package/cfgfs/src/wraps.c b/package/cfgfs/src/wraps.c
index 288f6dbab..0364c7b71 100644
--- a/package/cfgfs/src/wraps.c
+++ b/package/cfgfs/src/wraps.c
@@ -77,6 +77,14 @@ fwcf_pack(char *odata, size_t i, int algo, size_t *dstsz)
/* 12 bytes header, padding to 4-byte boundary, 4 bytes trailer */
k = ((j + 19) / 4) * 4;
+
+#if DEF_FLASHPART > 0xFFFFFF
+# error DEF_FLASHPART too large
+#endif
+ if (k > DEF_FLASHPART)
+ errx(1, "%lu bytes too large for flash partition of %lu KiB",
+ (u_long)k, DEF_FLASHPART / 1024UL);
+
/* padded to size of flash block */
#if (DEF_FLASHBLOCK & 3)
# error DEF_FLASHBLOCK must be dword-aligned