Re: [bug report] staging: ks7010: add new helpers to achieve mib set request and simplify code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 11, 2018 at 05:19:15PM +0300, Dan Carpenter wrote:
> Hello Sergio Paracuellos,
> 
> The patch 8ce76bff0e6a: "staging: ks7010: add new helpers to achieve
> mib set request and simplify code" from May 4, 2018, leads to the
> following static checker warning:
> 
> 	drivers/staging/ks7010/ks_hostif.c:1845 hostif_sme_multicast_set()
> 	warn: '2' cannot fit into 'bool'
> 
> drivers/staging/ks7010/ks_hostif.c
>   1831  static
>   1832  void hostif_sme_multicast_set(struct ks_wlan_private *priv)
>   1833  {
>   1834          struct net_device *dev = priv->net_dev;
>   1835          int mc_count;
>   1836          struct netdev_hw_addr *ha;
>   1837          char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
>   1838          int i = 0;
>   1839  
>   1840          spin_lock(&priv->multicast_spin);
>   1841  
>   1842          memset(set_address, 0, NIC_MAX_MCAST_LIST * ETH_ALEN);
>   1843  
>   1844          if (dev->flags & IFF_PROMISC) {
>   1845                  hostif_mib_set_request_bool(priv, LOCAL_MULTICAST_FILTER,
>   1846                                              MCAST_FILTER_PROMISC);
>                                                     ^^^^^^^^^^^^^^^^^^^^^
> This is 2 but casted to MCAST_FILTER_MCASTALL because hostif_mib_set_request_bool() takes a
> bool.

Yes, you are totally right. This seems to be wrong. We should pass an int instead
of a bool to avoid this problem.

> 
> In the original code, we used to pass 2 but as MIB_VALUE_TYPE_BOOL type.
> That's almost certainly buggy, but I don't know if it used to work on
> not.

Me neither but it is clear this is not what th original code was doing.

> 
>   1847                  goto spin_unlock;
>   1848          }
>   1849  
>   1850          if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) ||
>   1851              (dev->flags & IFF_ALLMULTI)) {
>   1852                  hostif_mib_set_request_bool(priv, LOCAL_MULTICAST_FILTER,
>   1853                                              MCAST_FILTER_MCASTALL);
>   1854                  goto spin_unlock;
>   1855          }
> 
> regards,
> dan carpenter

Best regards,
    Sergio Paracuellos
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux