public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Ekaterina Esina <eesina@astralinux.ru>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Won Kang <wkang77@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] gdm7240: Add check for NULL for callback in r
Date: Sat, 26 Nov 2022 12:44:55 +0300	[thread overview]
Message-ID: <Y4HgF21MXyb9YH+h@kadam> (raw)
In-Reply-To: <20221123132345.7071-1-eesina@astralinux.ru>

On Wed, Nov 23, 2022 at 04:23:45PM +0300, Ekaterina Esina wrote:
> Before dereferencing r->callback check it for NULL.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
> Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
> ---
>  drivers/staging/gdm724x/gdm_usb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
> index 54bdb64f52e8..7cf89f4c95c4 100644
> --- a/drivers/staging/gdm724x/gdm_usb.c
> +++ b/drivers/staging/gdm724x/gdm_usb.c
> @@ -409,10 +409,12 @@ static void do_rx(struct work_struct *work)
>  		switch (cmd_evt) {
>  		case LTE_GET_INFORMATION_RESULT:
>  			if (set_mac_address(hci->data, r->cb_data) == 0) {
> -				r->callback(r->cb_data,
> +				if (r->callback) {

What makes you think r->callback can be NULL?

So far as I can see that's not possible.  It is checked before it's
added to the list in gdm_usb_rcv_complete().

regards,
dan carpenter


      reply	other threads:[~2022-11-26  9:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 13:23 [PATCH] gdm7240: Add check for NULL for callback in r Ekaterina Esina
2022-11-26  9:44 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4HgF21MXyb9YH+h@kadam \
    --to=error27@gmail.com \
    --cc=eesina@astralinux.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=lvc-project@linuxtesting.org \
    --cc=wkang77@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox