[bug report] wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices
Dan Carpenter
error27 at gmail.com
Thu Feb 16 03:54:20 PST 2023
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
More information about the ath12k
mailing list