[openfirmware] [commit] r3202 - cpu/x86/pc/olpc/via

repository service svn at openfirmware.info
Mon Aug 20 11:44:00 CEST 2012


Author: quozl
Date: Mon Aug 20 11:44:00 2012
New Revision: 3202
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3202

Log:
OLPC - fs-update, sanity-check file size if the zdata file contains a size: header line, abort if invalid, ignore if missing, #12055

Modified:
   cpu/x86/pc/olpc/via/fsupdate.fth

Modified: cpu/x86/pc/olpc/via/fsupdate.fth
==============================================================================
--- cpu/x86/pc/olpc/via/fsupdate.fth	Mon Aug 20 11:35:44 2012	(r3201)
+++ cpu/x86/pc/olpc/via/fsupdate.fth	Mon Aug 20 11:44:00 2012	(r3202)
@@ -8,6 +8,11 @@
    push-hex $number pop-base  " Bad number" ?nand-abort
 ;
 
+: get-dhex#  ( -- d )
+   0 safe-parse-word
+   push-hex $dnumber pop-base  " Bad number" ?nand-abort
+;
+
 0 value min-eblock#
 0 value max-eblock#
 
@@ -145,6 +150,13 @@
    true to secure-fsupdate?
 ;
 
+0 2value file-bytes
+: size:  ( "bytes" -- )
+   get-dhex#                              ( d.size )
+   file-bytes d<>                         ( invalid? )
+   " Inconsistent size of zdata file" ?nand-abort
+;
+
 : erase-all  ( -- )
    #image-eblocks show-writing
 ;
@@ -259,6 +271,9 @@
    false to secure-fsupdate?           ( file$ )
    r/o open-file                       ( fd error? )
    " Can't open file" ?nand-abort      ( fd )
+   dup file-size                       ( fd [size.d] error? )
+   " Can't size file" ?nand-abort      ( fd size.d )
+   [ also nand-commands ] to file-bytes [ previous ]
 
    linefeed over force-line-delimiter  ( fd )
 



More information about the openfirmware mailing list