DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tvboxspy@gmail.com
Cc: devel@driverdev.osuosl.org
Subject: [bug report] staging: vt6656: vnt_beacon_xmit use extra_tx_headroom.
Date: Sat, 23 May 2020 13:10:40 +0300
Message-ID: <20200523101040.GA98132@mwanda> (raw)

Hello Malcolm Priestley,

The patch 9deca1e3e2b6: "staging: vt6656: vnt_beacon_xmit use
extra_tx_headroom." from May 16, 2020, leads to the following static
checker warning:

	drivers/staging/vt6656/rxtx.c:729 vnt_beacon_xmit()
	warn: struct type mismatch 'vnt_beacon_buffer vs vnt_tx_usb_header'

drivers/staging/vt6656/rxtx.c
   660  static int vnt_beacon_xmit(struct vnt_private *priv, struct sk_buff *skb)
   661  {
   662          struct vnt_beacon_buffer *beacon_buffer;
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So far as I can see this could be declared as a "vnt_tx_usb_header".
The "vnt_tx_usb_header" is the first member of the "vnt_beacon_buffer"
beacon struct.

   663          struct vnt_tx_short_buf_head *short_head;
   664          struct ieee80211_tx_info *info;
   665          struct vnt_usb_send_context *context;
   666          struct ieee80211_mgmt *mgmt_hdr;
   667          unsigned long flags;
   668          u32 frame_size = skb->len + 4;
   669          u16 current_rate, count;
   670  
   671          spin_lock_irqsave(&priv->lock, flags);
   672  
   673          context = vnt_get_free_context(priv);
   674          if (!context) {
   675                  dev_dbg(&priv->usb->dev, "%s No free context!\n", __func__);
   676                  spin_unlock_irqrestore(&priv->lock, flags);
   677                  return -ENOMEM;
   678          }
   679  
   680          context->skb = skb;
   681  
   682          spin_unlock_irqrestore(&priv->lock, flags);
   683  
   684          mgmt_hdr = (struct ieee80211_mgmt *)skb->data;
   685          short_head = skb_push(skb, sizeof(*short_head));
   686          count = skb->len;
   687  
   688          if (priv->bb_type == BB_TYPE_11A) {
   689                  current_rate = RATE_6M;
   690  
   691                  /* Get SignalField,ServiceField,Length */
   692                  vnt_get_phy_field(priv, frame_size, current_rate,
   693                                    PK_TYPE_11A, &short_head->ab);
   694  
   695                  /* Get TimeStampOff */
   696                  short_head->time_stamp_off =
   697                                  vnt_time_stamp_off(priv, current_rate);
   698          } else {
   699                  current_rate = RATE_1M;
   700                  short_head->fifo_ctl |= cpu_to_le16(FIFOCTL_11B);
   701  
   702                  /* Get SignalField,ServiceField,Length */
   703                  vnt_get_phy_field(priv, frame_size, current_rate,
   704                                    PK_TYPE_11B, &short_head->ab);
   705  
   706                  /* Get TimeStampOff */
   707                  short_head->time_stamp_off =
   708                          vnt_time_stamp_off(priv, current_rate);
   709          }
   710  
   711          /* Get Duration */
   712          short_head->duration = mgmt_hdr->duration;
   713  
   714          /* time stamp always 0 */
   715          mgmt_hdr->u.beacon.timestamp = 0;
   716  
   717          info = IEEE80211_SKB_CB(skb);
   718          if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
   719                  struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)mgmt_hdr;
   720  
   721                  hdr->duration_id = 0;
   722                  hdr->seq_ctrl = cpu_to_le16(priv->seq_counter << 4);
   723          }
   724  
   725          priv->seq_counter++;
   726          if (priv->seq_counter > 0x0fff)
   727                  priv->seq_counter = 0;
   728  
   729          beacon_buffer = skb_push(skb, sizeof(struct vnt_tx_usb_header));
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   730          beacon_buffer->usb.tx_byte_count = cpu_to_le16(count);
   731          beacon_buffer->usb.pkt_no = context->pkt_no;
   732          beacon_buffer->usb.type = 0x01;

We only need "beacon_buffer->usb".

   733  
   734          context->type = CONTEXT_BEACON_PACKET;
   735          context->tx_buffer = beacon_buffer;
                ^^^^^^^^^^^^^^^^^^
This is a void pointer.

   736          context->buf_len = skb->len;
   737  
   738          spin_lock_irqsave(&priv->lock, flags);
   739  
   740          if (vnt_tx_context(priv, context))
   741                  ieee80211_free_txskb(priv->hw, context->skb);
   742  
   743          spin_unlock_irqrestore(&priv->lock, flags);
   744  
   745          return 0;
   746  }

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

                 reply index

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=20200523101040.GA98132@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=tvboxspy@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

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git