1. 12 12月, 2015 2 次提交
    • A
      netcp: add more __le32 annotations · 9dd2d6c5
      Arnd Bergmann 提交于
      The handling of epib and psdata remains a bit unclear in the driver,
      as we access the same fields both as CPU-endian and through DMA
      from the device.
      
      Sparse warns about this:
      ti/netcp_core.c:1147:21: warning: incorrect type in assignment (different base types)
      ti/netcp_core.c:1147:21:    expected unsigned int [usertype] *[assigned] epib
      ti/netcp_core.c:1147:21:    got restricted __le32 *<noident>
      
      This uses __le32 types in a few places and uses __force where the code
      looks fishy. The previous patch should really have produced the correct
      behavior, but this second patch is needed to shut up the warnings about
      it. Ideally it would be slightly rewritten to not need those casts,
      but I don't dare do that without access to the hardware for proper
      testing.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9dd2d6c5
    • A
      netcp: try to reduce type confusion in descriptors · 89907779
      Arnd Bergmann 提交于
      The netcp driver produces tons of warnings when CONFIG_LPAE is enabled
      on ARM:
      
      drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_tx_map_skb':
      drivers/net/ethernet/ti/netcp_core.c:1084:13: warning: passing argument 1 of 'set_words' from incompatible pointer type [-Wincompatible-pointer-types]
      
      This is the result of trying to pass a pointer to a dma_addr_t to
      a function that expects a u32 pointer to copy that into a DMA descriptor.
      
      Looking at that code in more detail to fix the warnings, I see multiple
      related problems:
      
      * The conversion functions are not endian-safe, as the DMA descriptors
        are almost certainly fixed-endian, but the CPU is not.
      
      * On 64-bit machines, passing a pointer through a u32 variable is a
        bug, accessing an indirect pointer as a u32 pointer even more so.
      
      * The handling of epib and psdata mixes native-endian and device-endian
        data.
      
      In this patch, I try to sort out the types for most accesses here,
      adding le32_to_cpu/cpu_to_le32 where appropriate, and passing pointers
      through two 32-bit words in the descriptor padding, to make it plausible
      that the driver does the right thing if compiled for big-endian or
      64-bit systems.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      89907779
  2. 10 12月, 2015 1 次提交
    • T
      cgroup: fix sock_cgroup_data initialization on earlier compilers · ad2c8c73
      Tejun Heo 提交于
      sock_cgroup_data is a struct containing an anonymous union.
      sock_cgroup_set_prioidx() and sock_cgroup_set_classid() were
      initializing a field inside the anonymous union as follows.
      
       struct sock_ccgroup_data skcd_buf = { .val = VAL };
      
      While this is fine on more recent compilers, gcc-4.4.7 triggers the
      following errors.
      
       include/linux/cgroup-defs.h: In function ‘sock_cgroup_set_prioidx’:
       include/linux/cgroup-defs.h:619: error: unknown field ‘val’ specified in initializer
       include/linux/cgroup-defs.h:619: warning: missing braces around initializer
       include/linux/cgroup-defs.h:619: warning: (near initialization for ‘skcd_buf.<anonymous>’)
      
      This is because .val belongs to the anonymous union nested inside the
      struct but the initializer is missing the nesting.  Fix it by adding
      an extra pair of braces.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NAlaa Hleihel <alaa@dev.mellanox.co.il>
      Fixes: bd1060a1 ("sock, cgroup: add sock->sk_cgroup")
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ad2c8c73
  3. 09 12月, 2015 25 次提交
  4. 08 12月, 2015 10 次提交
  5. 07 12月, 2015 2 次提交
    • I
      mac80211: handle HW ROC expired properly · 1b894521
      Ilan Peer 提交于
      In case of HW ROC, when the driver reports that the ROC expired,
      it is not sufficient to purge the ROCs based on the remaining
      time, as it possible that the device finished the ROC session
      before the actual requested duration.
      
      To handle such cases, in case of ROC expired notification from
      the driver, complete all the ROCs which are marked with hw_begun,
      regardless of the remaining duration.
      Signed-off-by: NIlan Peer <ilan.peer@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      1b894521
    • R
      af_unix: fix unix_dgram_recvmsg entry locking · 64874280
      Rainer Weikusat 提交于
      The current unix_dgram_recvsmg code acquires the u->readlock mutex in
      order to protect access to the peek offset prior to calling
      __skb_recv_datagram for actually receiving data. This implies that a
      blocking reader will go to sleep with this mutex held if there's
      presently no data to return to userspace. Two non-desirable side effects
      of this are that a later non-blocking read call on the same socket will
      block on the ->readlock mutex until the earlier blocking call releases it
      (or the readers is interrupted) and that later blocking read calls
      will wait longer than the effective socket read timeout says they
      should: The timeout will only start 'ticking' once such a reader hits
      the schedule_timeout in wait_for_more_packets (core.c) while the time it
      already had to wait until it could acquire the mutex is unaccounted for.
      
      The patch avoids both by using the __skb_try_recv_datagram and
      __skb_wait_for_more packets functions created by the first patch to
      implement a unix_dgram_recvmsg read loop which releases the readlock
      mutex prior to going to sleep and reacquires it as needed
      afterwards. Non-blocking readers will thus immediately return with
      -EAGAIN if there's no data available regardless of any concurrent
      blocking readers and all blocking readers will end up sleeping via
      schedule_timeout, thus honouring the configured socket receive timeout.
      Signed-off-by: NRainer Weikusat <rweikusat@mobileactivedefense.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      64874280