All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kvalo@qca.qualcomm.com
Cc: linux-wireless@vger.kernel.org
Subject: re: ath6kl: add htc ops
Date: Mon, 7 Jul 2014 18:58:51 +0300	[thread overview]
Message-ID: <20140707155851.GA14528@mwanda> (raw)

Hello Kalle Valo,

This is a semi-automatic email about new static checker warnings.

The patch e76ac2bf637d: "ath6kl: add htc ops" from Mar 25, 2012, 
leads to the following Smatch complaint:

drivers/net/wireless/ath/ath6kl/htc_mbox.c:2886 ath6kl_htc_mbox_create()
	 error: we previously assumed 'target->dev' could be null (see line 2857)

drivers/net/wireless/ath/ath6kl/htc_mbox.c
  2856		target->dev = kzalloc(sizeof(*target->dev), GFP_KERNEL);
  2857		if (!target->dev) {
  2858			ath6kl_err("unable to allocate memory\n");
  2859			status = -ENOMEM;
  2860			goto err_htc_cleanup;

We will hit a NULL dereference in error handling on this path.

  2861		}
  2862	
  2863		spin_lock_init(&target->htc_lock);
  2864		spin_lock_init(&target->rx_lock);
  2865		spin_lock_init(&target->tx_lock);
  2866	
  2867		INIT_LIST_HEAD(&target->free_ctrl_txbuf);
  2868		INIT_LIST_HEAD(&target->free_ctrl_rxbuf);
  2869		INIT_LIST_HEAD(&target->cred_dist_list);
  2870	
  2871		target->dev->ar = ar;
  2872		target->dev->htc_cnxt = target;
  2873		target->ep_waiting = ENDPOINT_MAX;
  2874	
  2875		status = ath6kl_hif_setup(target->dev);
  2876		if (status)
  2877			goto err_htc_cleanup;
  2878	
  2879		status = ath6kl_htc_reset(target);
  2880		if (status)
  2881			goto err_htc_cleanup;
  2882	
  2883		return target;
  2884	
  2885	err_htc_cleanup:
  2886		ath6kl_htc_mbox_cleanup(target);

We can't call ath6kl_htc_mbox_cleanup() with a NULL target->dev pointer.
This is a One Err Bug because there is only one "err" label.

  2887	
  2888		return NULL;

regards,
dan carpenter

                 reply	other threads:[~2014-07-07 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140707155851.GA14528@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kvalo@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.