Re: [greybus-dev] [PATCH] greybus: Fix deref of NULL in __gb_lights_flash_brightness_set

Alex Elder
2024-03-04T13:30:06Z

On 3/2/24 10:35 AM, Rui Miguel Silva wrote:
>> So anyway, I think this (and Dan's suggestion) should be
>> addressed, but your fix might not be correct.
>>
>> Rui, can you please shed some light on the situation?
> As we talked, this email was sent at the same time as my replies to
> this thread and you think I addressed your concerns in that replies.
> If not, just go ahead and ask again.

Yes.

You said the intention was to return null if not found
(rather than "the passed-in value as default"). So that
bug should be fixed. Dan says he'll re-send that.

Either way, even if it's practically impossible, the
get_channel_from_mode() *can* return NULL, therefore
__gb_lights_flash_brightness_set() should be fixed to
avoid dereferencing the return value in such a case.

-Alex