All of lore.kernel.org
 help / color / mirror / Atom feed
* re: [PATCH] cfg80211: read wmm rules from regulatory database
@ 2018-07-31 11:27 ` Colin Ian King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2018-07-31 11:27 UTC (permalink / raw)
  To: Haim Dreyfuss, David S. Miller, Johannes Berg, netdev, linux-wireless
  Cc: linux-kernel

Hi Haim,

I think there may be an issue with the commit:

>From 230ebaa189af44d50dccb4a1846e39ca594e347b Mon Sep 17 00:00:00 2001
From: Haim Dreyfuss <haim.dreyfuss@intel.com>
Date: Wed, 28 Mar 2018 13:24:09 +0300
Subject: [PATCH] cfg80211: read wmm rules from regulatory database

specifically in function: reg_copy_regd()

+       for (i = 0; i < src_regd->n_reg_rules; i++) {
                memcpy(&regd->reg_rules[i], &src_regd->reg_rules[i],
                       sizeof(struct ieee80211_reg_rule));
+               if (!src_regd->reg_rules[i].wmm_rule)
+                       continue;

+               regd->reg_rules[i].wmm_rule = d_wmm +
+                       (src_regd->reg_rules[i].wmm_rule - s_wmm) /
+                       sizeof(struct ieee80211_wmm_rule);
+       }

The pointer arithmetic (src_regd->reg_rules[i].wmm_rule - s_wmm) is
performed in terms of the size of struct ieee80211_wmm_rule and not in
bytes and I believe that the division by sizeof(struct
ieee80211_wmm_rule) is not required.

This issue was detected by static analysis with Coverity Scan,
CID#1467451 ("Extra sizeof expression"), 'suspicious_division'

I'm not 100% sure that is this a false positive or not, but I think it
looks incorrect to me.

Colin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-01 15:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 11:27 [PATCH] cfg80211: read wmm rules from regulatory database Colin Ian King
2018-07-31 11:27 ` Colin Ian King
2018-08-01 13:23 ` Dreyfuss, Haim
2018-08-01 13:23   ` Dreyfuss, Haim

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.