Skip to contentSkip to conversation

: grub: Exliminate fixed length string buffers in child and devalias iterators.

PATCH In review David Miller 1 participant 2 messages Apr 20, 2009 – Apr 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : grub: Exliminate fixed length string buffers in child and devalias iterators.

I did a lot of extensive research, and had some conversations with a few openboot engineers, to determine the top-end values for properties and path lengths.

Using that I added some defines and got rid of the various fixed size stack lock buffers used throughout the openfirmware code. We now use dynamic allocation instead, and all of those ugly "XXX" comments can be removed.

Finally, this works around a long standing bug in OpenBoot wherein device alias properties are not NULL terminated. We allocate an extra byte and explicitly put a NULL character there in that extra byte at the end.

2009-04-19 David S. Miller <[email protected]>

* include/grub/ieee1275/ieee1275.h (IEEE1275_MAX_PROP_LEN, IEEE1275_MAX_PATH_LEN): Define.
* kern/ieee1275/openfw.c (grub_children_iterate): Dynamically allocate 'childtype', 'childpath', 'childname', and 'fullname'. (grub_devalias_iterate): Dynamically allocate 'aliasname' and 'devtype'. Explicitly NULL terminate devalias expansion.

---
 include/grub/ieee1275/ieee1275.h |    3 ++
 kern/ieee1275/openfw.c           |   64 ++++++++++++++++++++++++++++++++-----
 2 files changed, 58 insertions(+), 9 deletions(-)
include/grub/ieee1275/ieee1275.h +3 -0
index 3b5139e..ed02f52 100644
@@ -39,6 +39,9 @@ struct grub_ieee1275_mem_region
   unsigned int size;
 };
 
+#define IEEE1275_MAX_PROP_LEN	8192
+#define IEEE1275_MAX_PATH_LEN	256
+
 #ifndef IEEE1275_CALL_ENTRY_FN
 #define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
 #endif
kern/ieee1275/openfw.c +55 -9

122 lines not on this page · raw message

Signature · 1 line
1.6.2.3
#1 lore raw

From: David Miller <[email protected]>
Date: Sun, 19 Apr 2009 17:27:53 -0700 (PDT)

Quoted 8 lines

2009-04-19 David S. Miller <[email protected]>

* include/grub/ieee1275/ieee1275.h (IEEE1275_MAX_PROP_LEN, IEEE1275_MAX_PATH_LEN): Define.
* kern/ieee1275/openfw.c (grub_children_iterate): Dynamically allocate 'childtype', 'childpath', 'childname', and 'fullname'. (grub_devalias_iterate): Dynamically allocate 'aliasname' and 'devtype'. Explicitly NULL terminate devalias expansion.

Committed.