Skip to content
Snippets Groups Projects
  • Jon Povey's avatar
    735eb0f0
    tools/env: fix redundant env flag comparison · 735eb0f0
    Jon Povey authored
    
    This fixes two bugs with comparison of redundant environment flags on
    read.
    
    flag0 and flag1 in fw_env_open() were declared signed instead of
    unsigned char breaking BOOLEAN mode "== 0xFF" tests and in INCREMENTAL
    mode the wrong environment would be chosen where the flag values are
    127 and 128 (either way round). With both flags over 128, both signs
    flipped and the logic worked by happy accident.
    
    Also there was a logic bug in the INCREMENTAL test (after signedness was
    fixed) in the case flag0=0, flag1=255, env 1 would be incorrectly chosen.
    
    Fix both of these.
    
    Signed-off-by: default avatarJon Povey <jon.povey@racelogic.co.uk>
    735eb0f0
    History
    tools/env: fix redundant env flag comparison
    Jon Povey authored
    
    This fixes two bugs with comparison of redundant environment flags on
    read.
    
    flag0 and flag1 in fw_env_open() were declared signed instead of
    unsigned char breaking BOOLEAN mode "== 0xFF" tests and in INCREMENTAL
    mode the wrong environment would be chosen where the flag values are
    127 and 128 (either way round). With both flags over 128, both signs
    flipped and the logic worked by happy accident.
    
    Also there was a logic bug in the INCREMENTAL test (after signedness was
    fixed) in the case flag0=0, flag1=255, env 1 would be incorrectly chosen.
    
    Fix both of these.
    
    Signed-off-by: default avatarJon Povey <jon.povey@racelogic.co.uk>