[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02f31119-e35a-4358-a0a0-079416ba4a9d@moroto.mountain>
Date: Mon, 4 Mar 2024 09:29:47 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Rui Miguel Silva <rmfrfs@...il.com>
Cc: Mikhail Lobanov <m.lobanov@...alinux.ru>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] greybus: Fix deref of NULL in
__gb_lights_flash_brightness_set
On Sat, Mar 02, 2024 at 03:23:03PM +0000, Rui Miguel Silva wrote:
> Dan Carpenter <dan.carpenter@...aro.org> writes:
> Hi Dan,
>
> > On Fri, Mar 01, 2024 at 02:04:24PM -0500, Mikhail Lobanov wrote:
> >> Dereference of null pointer in the __gb_lights_flash_brightness_set function.
> >> Assigning the channel the result of executing the get_channel_from_mode function
> >> without checking for NULL may result in an error.
> >
> > get_channel_from_mode() can only return NULL when light->channels_count
> > is zero.
> >
> > Although get_channel_from_mode() seems buggy to me. If it can't
> > find the correct mode, it just returns the last channel. So potentially
> > it should be made to return NULL.
>
> Correct, thanks for the fix. Will you or me send a proper patch for
> this? Taking also the suggestion from Alex.
I'll send it. Thanks!
regards,
dan carpenter
Powered by blists - more mailing lists