• Ross Zwisler's avatar
    nfit_test: improve structure offset handling · d7d8464d
    Ross Zwisler authored
    
    
    In nfit_test0_setup() and nfit_test1_setup() we keep an 'offset' value
    which we use to calculate where in our 'nfit_buf' we will place our next
    structure.  The handling of 'offset' and the calculation of the placement
    of the next structure is a bit inconsistent, though.  We don't update
    'offset' after we insert each structure, sometimes causing us to update it
    for multiple structures' sizes at once.  When calculating the position of
    the next structure we aren't always able to just use 'offset', but
    sometimes have to add in other structure sizes as well.
    
    Fix this by updating 'offset' after each structure insertion in a
    consistent way, allowing us to always calculate the position of the next
    structure to be inserted by just using 'nfit_buf + offset'.
    Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    d7d8464d
nfit.c 72.2 KB