• T
    ALSA: control: Add input validation · f5e829f9
    Takashi Iwai 提交于
    This patch adds a new feature to enable the validation of input data
    to control elements in the ALSA core side.  When
    CONFIG_SND_CTL_INPUT_VALIDATION is set, ALSA core verifies whether the
    each input value via control API is in the defined ranges, also checks
    whether it's aligned to the defined steps.  If an invalid value is
    detected, ALSA core returns -EINVAL error immediately without passing
    further to the driver's callback.  So this is a kind of hardening for
    (badly written) drivers that have no proper error checks, at the cost
    of a slight performance overhead.
    
    Technically seen, this reuses a part of the existing validation code
    for CONFIG_SND_CTL_DEBUG case with a slight modification to suppress
    error prints for the input validation.
    
    Link: https://lore.kernel.org/r/20220609120219.3937-5-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
    f5e829f9
control.c 63.8 KB