• Alexander Graf's avatar
    linux-user: Allocate thunk size dynamically · 8be656b8
    Alexander Graf authored
    We store all struct types in an array of static size without ever
    checking whether we overrun it. Of course some day someone (like me
    in another, ancient ALSA enabling patch set) will run into the limit
    without realizing it.
    
    So let's make the allocation dynamic. We already know the number of
    structs that we want to allocate, so we only need to pass the variable
    into the respective piece of code.
    
    Also, to ensure we don't accidently overwrite random memory, add some
    asserts to sanity check whether a thunk is actually part of our array.
    Signed-off-by: 's avatarAlexander Graf <agraf@suse.de>
    Signed-off-by: 's avatarRiku Voipio <riku.voipio@linaro.org>
    8be656b8