public inbox for ath12k@lists.infradead.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: driver for Qualcomm Wi-Fi 7 devices
Date: Thu, 16 Feb 2023 14:54:20 +0300	[thread overview]
Message-ID: <Y+4ZbFTNtTqX7j4q@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/mac.c:4737 ath12k_mac_get_vdev_stats_id()
	warn: always true condition '(vdev_stats_id <= 255) => (0-255 <= 255)'

drivers/net/wireless/ath/ath12k/mac.c
    4728 static u8
    4729 ath12k_mac_get_vdev_stats_id(struct ath12k_vif *arvif)
    4730 {
    4731         struct ath12k_base *ab = arvif->ar->ab;
    4732         u8 vdev_stats_id = 0;
    4733 
    4734         do {
    4735                 if (ab->free_vdev_stats_id_map & (1LL << vdev_stats_id))

Shifting by more than 63 is undefined.

    4736                         vdev_stats_id++;
--> 4737                         if (vdev_stats_id <= ATH12K_INVAL_VDEV_STATS_ID) {

This if statement seems reversed.  It likely should be:

	if (vdev_stats_id > ATH12K_INVAL_VDEV_STATS_ID) {


But here as well ATH12K_INVAL_VDEV_STATS_ID is 255 and that's obviously
higher than 63.

    4738                                 vdev_stats_id = ATH12K_INVAL_VDEV_STATS_ID;
    4739                                 break;
    4740                         }
    4741                 } else {
    4742                         ab->free_vdev_stats_id_map |= (1LL << vdev_stats_id);
    4743                         break;
    4744                 }
    4745         } while (vdev_stats_id);
    4746 
    4747         arvif->vdev_stats_id = vdev_stats_id;
    4748         return vdev_stats_id;
    4749 }

regards,
dan carpenter

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

             reply	other threads:[~2023-02-16 11:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 11:54 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-14 17:33 [bug report] wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices Dan Carpenter
2023-02-16 12:28 Dan Carpenter
2023-02-16 11:44 Dan Carpenter
2023-02-16  9:57 Dan Carpenter

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+4ZbFTNtTqX7j4q@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox