ATH10K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: franciman12@gmail.com
Cc: ath10k@lists.infradead.org
Subject: [bug report] ath10k: abstract htt_rx_desc structure
Date: Tue, 1 Feb 2022 16:09:00 +0300	[thread overview]
Message-ID: <20220201130900.GD22458@kili> (raw)

Hello Francesco Magliocca,

The patch 6bae9de622d3: "ath10k: abstract htt_rx_desc structure" from
Jan 12, 2022, leads to the following Smatch static checker warning:

	drivers/net/wireless/ath/ath10k/htt_rx.c:432 ath10k_htt_rx_amsdu_pop()
	warn: potential pointer math issue ('rx_desc' is a 32 bit pointer)

drivers/net/wireless/ath/ath10k/htt_rx.c
    346 static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
    347                                    struct sk_buff_head *amsdu)
    348 {
    349         struct ath10k *ar = htt->ar;
    350         struct ath10k_hw_params *hw = &ar->hw_params;
    351         int msdu_len, msdu_chaining = 0;
    352         struct sk_buff *msdu;
    353         struct htt_rx_desc *rx_desc;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    354         struct rx_attention *rx_desc_attention;
    355         struct rx_frag_info_common *rx_desc_frag_info_common;
    356         struct rx_msdu_start_common *rx_desc_msdu_start_common;
    357         struct rx_msdu_end_common *rx_desc_msdu_end_common;
    358 

[ snip ]

    427 
    428                 last_msdu = __le32_to_cpu(rx_desc_msdu_end_common->info0) &
    429                                 RX_MSDU_END_INFO0_LAST_MSDU;
    430 
    431                 /* FIXME: why are we skipping the first part of the rx_desc? */
--> 432                 trace_ath10k_htt_rx_desc(ar, rx_desc + sizeof(u32),
                                                     ^^^^^^^^^^^^^^^^^^^^^
This is a pointer math bug.  It's possible that it should be:

	trace_ath10k_htt_rx_desc(ar, (u8 *)rx_desc + sizeof(u32),

But as your FIXME notes, it's hard to tell what's going on here...


    433                                          hw->rx_desc_ops->rx_desc_size - sizeof(u32));
    434 
    435                 if (last_msdu)
    436                         break;
    437         }

regards,
dan carpenter

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

             reply	other threads:[~2022-02-01 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 13:09 Dan Carpenter [this message]
2022-02-06 10:25 ` [bug report] ath10k: abstract htt_rx_desc structure Francesco Magliocca
2022-02-07  8:20   ` Kalle Valo

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=20220201130900.GD22458@kili \
    --to=dan.carpenter@oracle.com \
    --cc=ath10k@lists.infradead.org \
    --cc=franciman12@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