Skip to content
  • Ben Hutchings's avatar
    staging: speakup_soft: Fix reading of init string · 40fe4f89
    Ben Hutchings authored
    
    
    softsynth_read() reads a character at a time from the init string;
    when it finds the null terminator it sets the initialized flag but
    then repeats the last character.
    
    Additionally, if the read() buffer is not big enough for the init
    string, the next read() will start reading from the beginning again.
    So the caller may never progress to reading anything else.
    
    Replace the simple initialized flag with the current position in
    the init string, carried over between calls.  Switch to reading
    real data once this reaches the null terminator.
    
    (This assumes that the length of the init string can't change, which
    seems to be the case.  Really, the string and position belong together
    in a per-file private struct.)
    
    Tested-by: default avatarSamuel Thibault <sthibault@debian.org>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    40fe4f89