Fix uninitialized object usage in igc 6.12.

This commit is contained in:
Bjarne von Horn 2025-06-26 11:00:17 +02:00
parent 7294ebd078
commit ab89464e11
1 changed files with 9 additions and 0 deletions

View File

@ -268,6 +268,11 @@ int igc_led_setup(struct igc_adapter *adapter)
mutex_init(&adapter->led_mutex);
if (get_ecdev(adapter)) {
adapter->leds = NULL;
return 0;
}
leds = kcalloc(IGC_NUM_LEDS, sizeof(*leds), GFP_KERNEL);
if (!leds)
return -ENOMEM;
@ -295,6 +300,10 @@ void igc_led_free(struct igc_adapter *adapter)
struct igc_led_classdev *leds = adapter->leds;
int i;
if (get_ecdev(adapter)) {
return;
}
for (i = 0; i < IGC_NUM_LEDS; i++)
led_classdev_unregister(&((leds + i)->led));