diff options
author | Subrata Banik <subratabanik@google.com> | 2024-05-24 01:33:52 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2024-05-24 05:49:55 +0000 |
commit | 2889787522eac3895611c777b959eb66272b4c08 (patch) | |
tree | 2a1f6c085141e0b2e12b76e976795f4567ac4f07 | |
parent | bfc92cb94414b3a51490fefa203180914da06fbb (diff) |
mb/google/nissa: Fix potential null pointer dereference
* Introduce a null check before calling `gpio_padbased_override`
in `variant_configure_pads`.
* This prevents potential errors in cases where the
`variant_gpio_override_table` function returns a null pointer,
indicating that there are no override pads to configure.
BUG=b:334826281
TEST=Able to avoid hang incase there is no GPIO override.
Change-Id: I733210a08091b37eda6e6b0d6924aafd5e7e6280
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82628
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c index dc686fe242..64e1b14cfb 100644 --- a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c +++ b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c @@ -16,7 +16,8 @@ void variant_configure_pads(void) base_pads = variant_gpio_table(&base_num); gpio_padbased_override(padbased_table, base_pads, base_num); override_pads = variant_gpio_override_table(&override_num); - gpio_padbased_override(padbased_table, override_pads, override_num); + if (override_pads != NULL) + gpio_padbased_override(padbased_table, override_pads, override_num); fw_config_gpio_padbased_override(padbased_table); gpio_configure_pads_with_padbased(padbased_table); free(padbased_table); |