Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/82628?usp=email )
Change subject: mb/google/nissa: Fix potential null pointer dereference ......................................................................
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 --- M src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: Dinesh Gehlot: Looks good to me, approved Kapil Porwal: Looks good to me, approved Eric Lai: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c b/src/mainboard/google/brya/variants/baseboard/nissa/ramstage.c index dc686fe..64e1b14 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 @@ 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);