All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: quic_kvalo@quicinc.com
Cc: ath12k@lists.infradead.org
Subject: [bug report] wifi: ath12k: last element unused?
Date: Thu, 16 Feb 2023 17:00:39 +0300	[thread overview]
Message-ID: <Y+43B0+OUAFYeOAY@kili> (raw)

Hello Kalle Valo,

The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7
devices" from Nov 28, 2022, leads to the following Smatch static
checker warning:

	drivers/net/wireless/ath/ath12k/dp_rx.c:1172 ath12k_get_ppdu_user_index()
	warn: why is the last element skipped?

drivers/net/wireless/ath/ath12k/dp_rx.c
    1167 static int ath12k_get_ppdu_user_index(struct htt_ppdu_stats *ppdu_stats,
    1168                                       u16 peer_id)
    1169 {
    1170         int i;
    1171 
--> 1172         for (i = 0; i < HTT_PPDU_STATS_MAX_USERS - 1; i++) {

What's the - 1 for?  The "HTT_PPDU_STATS_MAX_USERS - 1" is done in
several places so maybe it's correct but I couldn't figure out what's
stored in the last element of the array.

    1173                 if (ppdu_stats->user_stats[i].is_valid_peer_id) {
    1174                         if (peer_id == ppdu_stats->user_stats[i].peer_id)
    1175                                 return i;
    1176                 } else {
    1177                         return i;
    1178                 }
    1179         }
    1180 
    1181         return -EINVAL;
    1182 }

regards,
dan carpenter

-- 
ath12k mailing list
ath12k@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/ath12k

                 reply	other threads:[~2023-02-16 14:00 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=Y+43B0+OUAFYeOAY@kili \
    --to=error27@gmail.com \
    --cc=ath12k@lists.infradead.org \
    --cc=quic_kvalo@quicinc.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 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.