Hello Emmanuel Grumbach,
The patch 2da4366f9e2c: "iwlwifi: mei: add the driver to allow
cooperation with CSME" from Nov 12, 2021, leads to the following
Smatch static checker warning:
drivers/net/wireless/intel/iwlwifi/mei/net.c:199 iwl_mei_rx_filter_ipv4()
warn: taking sizeof binop
drivers/net/wireless/intel/iwlwifi/mei/net.c
188 static bool iwl_mei_rx_filter_ipv4(struct sk_buff *skb,
189 const struct iwl_sap_oob_filters *filters,
190 rx_handler_result_t *rx_handler_res)
191 {
192 const struct iwl_sap_ipv4_filter *filt = &filters->ipv4_filter;
193 const struct iphdr *iphdr;
194 unsigned int iphdrlen;
195 bool match;
196
197 if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*iphdr)) ||
198 !pskb_may_pull(skb, skb_network_offset(skb) +
--> 199 sizeof(ip_hdrlen(skb) - sizeof(*iphdr))))
Probably this should be: ip_hdrlen(skb) - sizeof(*iphdr)?
200 return false;
201
202 iphdrlen = ip_hdrlen(skb);
regards,
dan carpenter
> Hello Emmanuel Grumbach,
>
> The patch 2da4366f9e2c: "iwlwifi: mei: add the driver to allow cooperation
> with CSME" from Nov 12, 2021, leads to the following Smatch static checker
> warning:
>
> drivers/net/wireless/intel/iwlwifi/mei/net.c:199
> iwl_mei_rx_filter_ipv4()
> warn: taking sizeof binop
>
> drivers/net/wireless/intel/iwlwifi/mei/net.c
> 188 static bool iwl_mei_rx_filter_ipv4(struct sk_buff *skb,
> 189 const struct iwl_sap_oob_filters *filters,
> 190 rx_handler_result_t *rx_handler_res)
> 191 {
> 192 const struct iwl_sap_ipv4_filter *filt = &filters->ipv4_filter;
> 193 const struct iphdr *iphdr;
> 194 unsigned int iphdrlen;
> 195 bool match;
> 196
> 197 if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*iphdr))
> ||
> 198 !pskb_may_pull(skb, skb_network_offset(skb) +
> --> 199 sizeof(ip_hdrlen(skb) - sizeof(*iphdr))))
>
> Probably this should be: ip_hdrlen(skb) - sizeof(*iphdr)?
Ouch....
Thanks!