Skip to content

Commit

Permalink
ASoC: cs-amp-lib: Fix NULL pointer crash if efi.get_variable is NULL
Browse files Browse the repository at this point in the history
Call efi_rt_services_supported() to check that efi.get_variable exists
before calling it.

Signed-off-by: Richard Fitzgerald <[email protected]>
Fixes: 1cad872 ("ASoC: cs-amp-lib: Add helpers for factory calibration data")
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
rfvirgil authored and broonie committed Aug 5, 2024
1 parent 93afd02 commit dc26808
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/codecs/cs-amp-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static efi_status_t cs_amp_get_efi_variable(efi_char16_t *name,

KUNIT_STATIC_STUB_REDIRECT(cs_amp_get_efi_variable, name, guid, size, buf);

if (IS_ENABLED(CONFIG_EFI))
if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE))
return efi.get_variable(name, guid, &attr, size, buf);

return EFI_NOT_FOUND;
Expand Down

0 comments on commit dc26808

Please sign in to comment.