• Oswald Buddenhagen's avatar
    ALSA: emux: centralize & improve patch info validation · de67aab1
    Oswald Buddenhagen authored
    This does several closely related things:
    - Move the code from the drivers into the SoundFont loader, which
      de-duplicates it.
    - Sort of explain the weird "recalculate address offset" feature. Note
      that I don't think it actually makes any sense - the calling user
      space code should do that. The background is certainly that the source
      data (the SoundFont format) uses pointers into a single wave block
      (and the API allows doing the same for on-board ROM), but the API
      expects the wave data from user space to be pre-chopped into
      individual patches anyway.
    - Make sure that the specified offsets actually lie within the supplied
      wave data. Note that we don't validate ROM offsets, so one can play
      back anything within the sound card's address space.
    - In load_guspatch(), don't call the sample_new callback anymore when
      the patch size is zero, as was already the case in load_data(). The
      callbacks would instantly return in that case anyway; these checks are
      now removed.
    Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
    Message-ID: <20240406064830.1029573-7-oswald.buddenhagen@gmx.de>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    de67aab1
emu10k1_patch.c 3.55 KB