RE: [PATCH v2 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)

2017-08-24 Thread Dexuan Cui
> From: David Miller [mailto:da...@davemloft.net]
> Sent: Thursday, August 24, 2017 18:20
> > +#define VMBUS_PKT_TRAILER  (sizeof(u64))
>
> This is not the packet trailer, it's the size of the packet trailer.

Thanks! I'll change it to VMBUS_PKT_TRAILER_SIZE.

> > +   /* Have we sent the zero-length packet (FIN)? */
> > +   unsigned long fin_sent;
>
> Why does this need to be atomic?  Why can't a smaller simpler
It doesn't have to be. It was originally made for a quick workaround.
Thanks! I should do it in the right way now.

> mechanism be used to make sure hvs_shutdown() only performs
> hvs_send_data() call once on the channel?
I'll change "fin_sent" to bool, and avoid test_and_set_bit().
I'll add lock_sock/release_sock()  in hvs_shutdown() like this:

static int hvs_shutdown(struct vsock_sock *vsk, int mode)
{
 ...
   lock_sock(sk);

hvs = vsk->trans;
if (hvs->fin_sent)
goto out;

send_buf = (struct hvs_send_buf *)
(void)hvs_send_data(hvs->chan, send_buf, 0);

hvs->fin_sent = true;
out:
release_sock(sk);
return 0;
}

> > +static inline bool is_valid_srv_id(const uuid_le *id)
> > +{
> > +   return !memcmp(>b[4], _id_template.b[4], sizeof(uuid_le) -
> 4);
> > +}
>
> Do not use the inline function attribute in *.c code.  Let the
> compiler decide.

OK. Will remove all the inline usages.

> > +   *((u32 *)>vm_srv_id) = vsk->local_addr.svm_port;
> > +   *((u32 *)>host_srv_id) = vsk->remote_addr.svm_port;
>
> There has to be a better way to express this.
I may need to define a uinon here. Let me try it.

 > And if this is partially initializing vm_srv_id, at a minimum
> endianness needs to be taken into account.
I may need to use cpu_to_le32(). Let me check it.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtlwifi: Improve debugging by using debugfs

2017-08-24 Thread Andrew Lunn
On Thu, Aug 24, 2017 at 04:28:08PM -0500, Larry Finger wrote:
> The changes in this commit are also being sent to the main rtlwifi
> drivers in wireless-next; however, these changes will also be useful for
> any debugging of r8822be before it gets moved into the main tree.
> 
> Use debugfs to dump register and btcoex status, and also write registers
> and h2c.
> 
> We create topdir in /sys/kernel/debug/rtlwifi/, and use the MAC address
> as subdirectory with several entries to dump mac_reg, bb_reg, rf_reg etc.
> An example is
> /sys/kernel/debug/rtlwifi/00-11-22-33-44-55-66/mac_0
> 
> This change permits examination of device registers in a dynamic manner,
> a feature not available with the current debug mechanism.

Hi Larry

netdev frowns upon debugfs. You should try to keep this altogether,
making it easy to throw away before the driver is moved out of
staging.

You might want to look at ethtool -d. That will be accepted.

Andrew
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)

2017-08-24 Thread David Miller
From: Dexuan Cui 
Date: Wed, 23 Aug 2017 04:52:14 +

> +#define VMBUS_PKT_TRAILER(sizeof(u64))

This is not the packet trailer, it's the size of the packet trailer.
Please make this macro name match more accurately what it is.

> + /* Have we sent the zero-length packet (FIN)? */
> + unsigned long fin_sent;

Why does this need to be atomic?  Why can't a smaller simpler
mechanism be used to make sure hvs_shutdown() only performs
hvs_send_data() call once on the channel?

> +static inline bool is_valid_srv_id(const uuid_le *id)
> +{
> + return !memcmp(>b[4], _id_template.b[4], sizeof(uuid_le) - 4);
> +}

Do not use the inline function attribute in *.c code.  Let the
compiler decide.

> +static inline unsigned int get_port_by_srv_id(const uuid_le *svr_id)

Likewise.

> +static inline void hvs_addr_init(struct sockaddr_vm *addr,

Likewise.

> +static inline void hvs_remote_addr_init(struct sockaddr_vm *remote,
> + struct sockaddr_vm *local)

Likewise.

And so on and so forth, please audit this for your entire patch.

> + *((u32 *)>vm_srv_id) = vsk->local_addr.svm_port;
> + *((u32 *)>host_srv_id) = vsk->remote_addr.svm_port;

There has to be a better way to express this.

And if this is partially initializing vm_srv_id, at a minimum
endianness needs to be taken into account.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] Revert "staging: Fix build issues with new binder API"

2017-08-24 Thread Jisheng Zhang
This reverts commit d0bdff0db809 ("staging: Fix build issues with new
binder API"), because commit e38361d032f1 ("ARM: 8091/2: add get_user()
support for 8 byte types") has added the 64bit __get_user_asm_*
implementation.

Signed-off-by: Jisheng Zhang 
---
 Since v2:
  - fix the commit msg again.
 Since v1:
  - fix the commit msg
 drivers/android/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
index 832e885349b1..aca5dc30b97b 100644
--- a/drivers/android/Kconfig
+++ b/drivers/android/Kconfig
@@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES
  therefore logically separated from the other devices.
 
 config ANDROID_BINDER_IPC_32BIT
-   bool
+   bool "Use old (Android 4.4 and earlier) 32-bit binder API"
depends on !64BIT && ANDROID_BINDER_IPC
default y
---help---
-- 
2.14.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] binder: allow ANDROID_BINDER_IPC_32BIT to be unselected on 32bit ARM

2017-08-24 Thread Greg KH
On Thu, Aug 24, 2017 at 10:49:28AM +0800, Jisheng Zhang wrote:
> As noted in commit d0bdff0db809 ("staging: Fix build issues with new
> binder API"), we can add back the choice for 32bit ARM "once a 64bit
> __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM:
> 8091/2: add get_user() support for 8 byte types") has added the
> support, so it's time to allow ANDROID_BINDER_IPC_32BIT to be
> unselected on 32bit ARM so that the 64bit ABI can be tested/used on
> 32bit systems.
> 
> This change allows running the same 32bit userspace build no matter
> the kernel is 64bit or 32bit.
> 
> Signed-off-by: Jisheng Zhang 
> ---
>  Since v1:
>   - fix the commit msg 
> 
>  drivers/android/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
> index 832e885349b1..aca5dc30b97b 100644
> --- a/drivers/android/Kconfig
> +++ b/drivers/android/Kconfig
> @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES
> therefore logically separated from the other devices.
>  
>  config ANDROID_BINDER_IPC_32BIT
> - bool
> + bool "Use old (Android 4.4 and earlier) 32-bit binder API"

Again, your changelog text does not match up with what this patch does
at all, please fix something...

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: rtlwifi: add MAC80211 dependency

2017-08-24 Thread Greg Kroah-Hartman
On Thu, Aug 24, 2017 at 02:23:08PM -0500, Larry Finger wrote:
> On 08/23/2017 08:22 AM, Arnd Bergmann wrote:
> > Like the version in drivers/net/wireless, this driver requires the
> > MAC80211 framework, otherwise we run into a link error:
> > 
> > ERROR: "ieee80211_rx_irqsafe" [drivers/staging/rtlwifi/r8822be.ko] 
> > undefined!
> > ERROR: "cfg80211_unlink_bss" [drivers/staging/rtlwifi/r8822be.ko] undefined!
> > ERROR: "ieee80211_beacon_get_tim" [drivers/staging/rtlwifi/r8822be.ko] 
> > undefined!
> > ERROR: "ieee80211_resume_disconnect" [drivers/staging/rtlwifi/r8822be.ko] 
> > undefined!
> > 
> > This adds the Kconfig dependency for it.
> > 
> > Fixes: 56bde846304e ("staging: r8822be: Add existing rtlwifi and rtl_pci 
> > parts for new driver")
> > Signed-off-by: Arnd Bergmann 
> 
> Greg,
> 
> I lost track of which version of this patch you are taking. The one that
> Randy Dunlap sent that added NETDEVICES was better than the initial version,
> but this one with MAC80211 is the correct one. Randy's patch is in the
> latest pull I did on staging.
> 
> Do you want an updated patch?

Nope, all should be good now, I've fixed it by hand.  Look in my tree
and if it's still wrong there, please send me a fixup.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: gdm724x: Rename variable for consistency

2017-08-24 Thread Nick Fox
Rename dftEpsId variable to dft_eps_ID to be consistent with other
variables in the source file.

Signed-off-by: Nick Fox 
---
 drivers/staging/gdm724x/hci_packet.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gdm724x/hci_packet.h 
b/drivers/staging/gdm724x/hci_packet.h
index 22ce8b9477b6..d9e41e457f83 100644
--- a/drivers/staging/gdm724x/hci_packet.h
+++ b/drivers/staging/gdm724x/hci_packet.h
@@ -50,7 +50,7 @@ struct tlv {
 struct sdu_header {
__dev16 cmd_evt;
__dev16 len;
-   __dev32 dftEpsId;
+   __dev32 dft_eps_ID;
__dev32 bearer_ID;
__dev32 nic_type;
 } __packed;
@@ -76,7 +76,7 @@ struct hci_pdn_table_ind {
__dev16 cmd_evt;
__dev16 len;
u8 activate;
-   __dev32 dft_eps_id;
+   __dev32 dft_eps_ID;
__dev32 nic_type;
u8 pdn_type;
u8 ipv4_addr[4];
-- 
2.13.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net-next v3 2/7] netvsc: fix warnings reported by lockdep

2017-08-24 Thread Stephen Hemminger
These are false positives; lockdep is complaining about things that are safe
It is just that annotations were missing or incorrect.

-Original Message-
From: David Woodhouse [mailto:dw...@infradead.org] 
Sent: Thursday, August 24, 2017 1:37 AM
To: Stephen Hemminger ; KY Srinivasan 
; Haiyang Zhang ; Stephen Hemminger 

Cc: de...@linuxdriverproject.org; net...@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/7] netvsc: fix warnings reported by lockdep

On Fri, 2017-07-28 at 08:59 -0700, Stephen Hemminger wrote:
> This includes a bunch of fixups for issues reported by
> lockdep.
>    * ethtool routines can assume RTNL
>    * send is done with RCU lock (and BH disable)
>    * avoid refetching internal device struct (netvsc)
>  instead pass it as a parameter.
> 
> Signed-off-by: Stephen Hemminger 

The subject and the commit message are inconsistent — is this fixing
*warnings* (i.e. shut up a false positive), or is it fixing *issues*?
It looks like it's actually fixing issues, not just warnings?

It's really useful to get that right.

FWIW the reason I'm looking in my netdev@ folder for lockdep warning
fixes is because I was trying to confirm whether the commit message in
https://patchwork.kernel.org/patch/4372391/ is actually telling the
truth or not — in that case I think it *is* just a false positive being
shut up (and thus it's OK to say "fix warning"), not really fixing a
true issue.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Drivers: hv: vmbus: Fix rescind handling issues

2017-08-24 Thread Stephen Hemminger
On Fri, 11 Aug 2017 10:03:59 -0700
k...@exchange.microsoft.com wrote:

> From: K. Y. Srinivasan 
> 
> This patch handles the following issues that were observed when we are
> handling racing channel offer message and rescind message for the same
> offer:
> 
> 1. Since the host does not respond to messages on a rescinded channel,
> in the current code, we could be indefinitely blocked on the vmbus_open() 
> call.
> 
> 2. When a rescinded channel is being closed, if there is a pending interrupt 
> on the
> channel, we could end up freeing the channel that the interrupt handler would 
> run on.
> 
> Signed-off-by: K. Y. Srinivasan 
> Reviewed-by: Dexuan Cui 
> Tested-by: Dexuan Cui 

This patch breaks re-initialization of the network device on MTU changes.

Doing:
# ip li set dev eth1 mtu 9000

will hang in rndis_filter_add waiting for subchannel notification.
This is likely because when the vmbus device is reopened the sub channels
are not correctly created.  Not sure what is wrong with the patch, but my
suspicion is that the close/rescind events are no longer being sent to the
host.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtlwifi: Improve debugging by using debugfs

2017-08-24 Thread Larry Finger
The changes in this commit are also being sent to the main rtlwifi
drivers in wireless-next; however, these changes will also be useful for
any debugging of r8822be before it gets moved into the main tree.

Use debugfs to dump register and btcoex status, and also write registers
and h2c.

We create topdir in /sys/kernel/debug/rtlwifi/, and use the MAC address
as subdirectory with several entries to dump mac_reg, bb_reg, rf_reg etc.
An example is
/sys/kernel/debug/rtlwifi/00-11-22-33-44-55-66/mac_0

This change permits examination of device registers in a dynamic manner,
a feature not available with the current debug mechanism.

We use seq_file to replace RT_TRACE to dump status, then we can use 'cat'
to access btcoex's status through debugfs.
(i.e. /sys/kernel/debug/rtlwifi/00-11-22-33-44-55-66/btcoex)
Other related changes are
1. implement btc_disp_dbg_msg() to access btcoex's common status.
2. remove obsolete field bt_exist

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
 drivers/staging/rtlwifi/debug.c | 226 
 1 file changed, 135 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/rtlwifi/debug.c b/drivers/staging/rtlwifi/debug.c
index b9fd47aeaa9b..7446d71c41d1 100644
--- a/drivers/staging/rtlwifi/debug.c
+++ b/drivers/staging/rtlwifi/debug.c
@@ -80,9 +80,11 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, 
int level,
}
 }
 
-struct rtl_debgufs_priv {
+struct rtl_debugfs_priv {
struct rtl_priv *rtlpriv;
-   int (*cb)(struct seq_file *m, void *v);
+   int (*cb_read)(struct seq_file *m, void *v);
+   ssize_t (*cb_write)(struct file *filp, const char __user *buffer,
+   size_t count, loff_t *loff);
u32 cb_data;
 };
 
@@ -90,9 +92,9 @@ static struct dentry *debugfs_topdir;
 
 static int rtl_debug_get_common(struct seq_file *m, void *v)
 {
-   struct rtl_debgufs_priv *debugfs_priv = m->private;
+   struct rtl_debugfs_priv *debugfs_priv = m->private;
 
-   return debugfs_priv->cb(m, v);
+   return debugfs_priv->cb_read(m, v);
 }
 
 static int dl_debug_open_common(struct inode *inode, struct file *file)
@@ -109,7 +111,7 @@ static const struct file_operations file_ops_common = {
 
 static int rtl_debug_get_mac_page(struct seq_file *m, void *v)
 {
-   struct rtl_debgufs_priv *debugfs_priv = m->private;
+   struct rtl_debugfs_priv *debugfs_priv = m->private;
struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
u32 page = debugfs_priv->cb_data;
int i, n;
@@ -126,8 +128,8 @@ static int rtl_debug_get_mac_page(struct seq_file *m, void 
*v)
 }
 
 #define RTL_DEBUG_IMPL_MAC_SERIES(page, addr)  \
-struct rtl_debgufs_priv rtl_debug_priv_mac_ ##page = { \
-   .cb = rtl_debug_get_mac_page,   \
+struct rtl_debugfs_priv rtl_debug_priv_mac_ ##page = { \
+   .cb_read = rtl_debug_get_mac_page,  \
.cb_data = addr,\
 }
 
@@ -150,7 +152,7 @@ RTL_DEBUG_IMPL_MAC_SERIES(17, 0x1700);
 
 static int rtl_debug_get_bb_page(struct seq_file *m, void *v)
 {
-   struct rtl_debgufs_priv *debugfs_priv = m->private;
+   struct rtl_debugfs_priv *debugfs_priv = m->private;
struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
struct ieee80211_hw *hw = rtlpriv->hw;
u32 page = debugfs_priv->cb_data;
@@ -168,8 +170,8 @@ static int rtl_debug_get_bb_page(struct seq_file *m, void 
*v)
 }
 
 #define RTL_DEBUG_IMPL_BB_SERIES(page, addr)   \
-struct rtl_debgufs_priv rtl_debug_priv_bb_ ##page = {  \
-   .cb = rtl_debug_get_bb_page,\
+struct rtl_debugfs_priv rtl_debug_priv_bb_ ##page = {  \
+   .cb_read = rtl_debug_get_bb_page,   \
.cb_data = addr,\
 }
 
@@ -192,7 +194,7 @@ RTL_DEBUG_IMPL_BB_SERIES(1f, 0x1f00);
 
 static int rtl_debug_get_reg_rf(struct seq_file *m, void *v)
 {
-   struct rtl_debgufs_priv *debugfs_priv = m->private;
+   struct rtl_debugfs_priv *debugfs_priv = m->private;
struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv;
struct ieee80211_hw *hw = rtlpriv->hw;
enum radio_path rfpath = debugfs_priv->cb_data;
@@ -215,8 +217,8 @@ static int rtl_debug_get_reg_rf(struct seq_file *m, void *v)
 }
 
 #define RTL_DEBUG_IMPL_RF_SERIES(page, addr)   \
-struct rtl_debgufs_priv rtl_debug_priv_rf_ ##page = {  \
-   .cb = rtl_debug_get_reg_rf, \
+struct rtl_debugfs_priv rtl_debug_priv_rf_ ##page = {  \
+   .cb_read = rtl_debug_get_reg_rf,\
.cb_data = addr,\
 }
 
@@ -225,7 +227,7 @@ RTL_DEBUG_IMPL_RF_SERIES(b, RF90_PATH_B);
 
 static int 

Re: [PATCH] Staging: Android: fix code style in ion_cma_heap.c

2017-08-24 Thread Joe Perches
On Thu, 2017-08-24 at 21:10 +0530, Abishek V Ashok wrote:
> This is a patch to the ion_cma_heap.c file in
> /drivers/staging/andrioid/ion that fixes a blank line and
> kmalloc size warning found by the checkpatch.pl tool.
[]
> diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
> b/drivers/staging/android/ion/ion_cma_heap.c
[]
> @@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
> ion_buffer *buffer,
>   if (!pages)
>   return -ENOMEM;
> 
> - table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> + table = kmalloc(sizeof(struct * table), GFP_KERNEL);

Please make sure you compile the files modified by
your proposed patches before sending the patches.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/5] android: binder: Move buffer out of area shared with user space

2017-08-24 Thread Dan Carpenter
On Wed, Aug 23, 2017 at 08:46:41AM -0700, Sherry Yang wrote:
> Binder driver allocates buffer meta data in a region that is mapped
> in user space. These meta data contain pointers in the kernel.
> 
> This patch allocates buffer meta data on the kernel heap that is
> not mapped in user space, and uses a pointer to refer to the data mapped.
> 

This feels like it has a security impact, right?  The original code is
an info leak?

> @@ -664,7 +679,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,
>  
>   return 0;
>  
> -err_alloc_small_buf_failed:
> +err_alloc_buf_struct_failed:
>   kfree(alloc->pages);
>   alloc->pages = NULL;
>  err_alloc_pages_failed:

Not really really related to your patch, I was just looking at the
error handling here.  It looks like this with your patch applied.

   682  err_alloc_buf_struct_failed:
   683  kfree(alloc->pages);
   684  alloc->pages = NULL;
   685  err_alloc_pages_failed:
   686  mutex_lock(_alloc_mmap_lock);
   687  vfree(alloc->buffer);

The vfree() here is supposed to release the resources from get_vm_area().
Why do people not use free_vm_area() instead?  It feels like we're
freeing "area->addr" but leaking "area" itself but perhaps I have
misunderstood something.

   688  alloc->buffer = NULL;
   689  err_get_vm_area_failed:
   690  err_already_mapped:
   691  mutex_unlock(_alloc_mmap_lock);
   692  pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
   693 alloc->pid, vma->vm_start, vma->vm_end, failure_string, 
ret);
   694  return ret;

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: rtlwifi: add MAC80211 dependency

2017-08-24 Thread Larry Finger

On 08/23/2017 08:22 AM, Arnd Bergmann wrote:

Like the version in drivers/net/wireless, this driver requires the
MAC80211 framework, otherwise we run into a link error:

ERROR: "ieee80211_rx_irqsafe" [drivers/staging/rtlwifi/r8822be.ko] undefined!
ERROR: "cfg80211_unlink_bss" [drivers/staging/rtlwifi/r8822be.ko] undefined!
ERROR: "ieee80211_beacon_get_tim" [drivers/staging/rtlwifi/r8822be.ko] 
undefined!
ERROR: "ieee80211_resume_disconnect" [drivers/staging/rtlwifi/r8822be.ko] 
undefined!

This adds the Kconfig dependency for it.

Fixes: 56bde846304e ("staging: r8822be: Add existing rtlwifi and rtl_pci parts for 
new driver")
Signed-off-by: Arnd Bergmann 


Greg,

I lost track of which version of this patch you are taking. The one that Randy 
Dunlap sent that added NETDEVICES was better than the initial version, but this 
one with MAC80211 is the correct one. Randy's patch is in the latest pull I did 
on staging.


Do you want an updated patch?

Larry


---
  drivers/staging/rtlwifi/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtlwifi/Kconfig b/drivers/staging/rtlwifi/Kconfig
index fc482b49f9aa..cb3a29ae764b 100644
--- a/drivers/staging/rtlwifi/Kconfig
+++ b/drivers/staging/rtlwifi/Kconfig
@@ -1,6 +1,6 @@
  config R8822BE
tristate "Realtek RTL8822BE Wireless Network Adapter"
-   depends on PCI && m
+   depends on PCI && MAC80211 && m
select FW_LOADER
---help---
This is the staging driver for Realtek RTL8822BE 802.11ac PCIe



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: Android: fix code style in ion_cma_heap.c

2017-08-24 Thread Dan Carpenter
On Thu, Aug 24, 2017 at 09:10:50PM +0530, Abishek V Ashok wrote:
> @@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
> ion_buffer *buffer,
>   if (!pages)
>   return -ENOMEM;
> 
> - table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> + table = kmalloc(sizeof(struct * table), GFP_KERNEL);

You didn't try compile this.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: rtlwifi: simplify logical operation

2017-08-24 Thread Larry Finger

On 08/23/2017 08:22 AM, Arnd Bergmann wrote:

gcc notices a very complicated way to check a value
for being equal to one, and warns about it:

drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c: In function 
'halbtc8822b1ant_set_ext_ant_switch':
drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c:2105:9: error: '~' on a 
boolean expression [-Werror=bool-operation]
  ~switch_polatiry_inverse :
  ^
drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c:2105:9: note: did you mean 
to use logical not?
  ~switch_polatiry_inverse :
  ^

This simplifies this expression to make it more readable
and to make gcc happy.

Fixes: 56bde846304e ("staging: r8822be: Add existing rtlwifi and rtl_pci parts for 
new driver")
Signed-off-by: Arnd Bergmann 


Yes, it should have bee logical not rather than a bitwise inversion. Your 
version is much more readable. In a followup, I will fix the spelling of 
polarity, but yours is fine.


Acked-by: Larry Finger 

Larry


---
  drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c 
b/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c
index 933d188d52b4..157395b85405 100644
--- a/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c
+++ b/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c
@@ -2101,9 +2101,7 @@ static void halbtc8822b1ant_set_ext_ant_switch(struct 
btc_coexist *btcoexist,
 * 0xcbd[1:0] = 2b'01 => Ant to BTG,
 * 0xcbd[1:0] = 2b'10 => Ant to WLG
 */
-   switch_polatiry_inverse = (rfe_type->ext_ant_switch_ctrl_polarity == 1 ?
-  ~switch_polatiry_inverse :
-  switch_polatiry_inverse);
+   switch_polatiry_inverse = rfe_type->ext_ant_switch_ctrl_polarity == 1;
  
  	switch (pos_type) {

default:



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: r8822be: fix null pointer dereference with a null driver_adapter

2017-08-24 Thread Larry Finger

On 08/23/2017 10:07 AM, Colin King wrote:

From: Colin Ian King 

The call to _rtl_dbg_trace via macro HALMAC_RT_TRACE will trigger a null
pointer deference on the null driver_adapter.  Fix this by assigning
driver_adapter earlier to halmac_adapter->driver_adapter before the tracing
call so that a non-null driver_adapter is passed instead.

Detected by CoverityScan, CID#1454613 ("Explicit null dereferenced")

Fixes: 938a0447f094 ("staging: r8822be: Add code for halmac sub-driver")
Signed-off-by: Colin Ian King 


Acked-by: Larry Finger 

Thanks,

Larry


---
  drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c 
b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
index a6c8a87f755f..3a24e33228f8 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
@@ -4447,7 +4447,7 @@ halmac_func_p2pps_88xx(struct halmac_adapter 
*halmac_adapter,
  {
u8 h2c_buff[HALMAC_H2C_CMD_SIZE_88XX] = {0};
u16 h2c_seq_mum = 0;
-   void *driver_adapter = NULL;
+   void *driver_adapter = halmac_adapter->driver_adapter;
struct halmac_api *halmac_api;
struct halmac_h2c_header_info h2c_header_info;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
@@ -4455,7 +4455,6 @@ halmac_func_p2pps_88xx(struct halmac_adapter 
*halmac_adapter,
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_H2C, DBG_DMESG,
"[TRACE]halmac_p2pps !!\n");
  
-	driver_adapter = halmac_adapter->driver_adapter;

halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
  
  	P2PPS_SET_OFFLOAD_EN(h2c_buff, p2p_ps->offload_en);




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtlwifi: check for array overflow

2017-08-24 Thread Larry Finger

On 08/24/2017 05:08 AM, Dan Carpenter wrote:

Smatch is distrustful of the "capab" value and marks it as user
controlled.  I think it actually comes from the firmware?  Anyway, I
looked at other drivers and they added a bounds check and it seems like
a harmless thing to have so I have added it here as well.

Signed-off-by: Dan Carpenter 


Acked-by: Larry Finger 

Thanks,

Larry



diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index f7f207cbaee3..a30b928d5ee1 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -1414,6 +1414,10 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx)
  le16_to_cpu(mgmt->u.action.u.addba_req.capab);
tid = (capab &
   IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+   if (tid >= MAX_TID_COUNT) {
+   rcu_read_unlock();
+   return true;
+   }
tid_data = _entry->tids[tid];
if (tid_data->agg.rx_agg_state ==
RTL_RX_AGG_START)



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] staging: olpc_dcon: remove pointless debug printk in dcon_freeze_store()

2017-08-24 Thread Dan Carpenter
Thanks!

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 11/15] remoteproc: make device_type const

2017-08-24 Thread Bjorn Andersson
On Sat 19 Aug 01:22 PDT 2017, Bhumika Goyal wrote:

> Make this const as it is only stored in the type field of a device
> structure, which is const.
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal 

Applied, thanks.

Regards,
Bjorn

> ---
>  drivers/remoteproc/remoteproc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c 
> b/drivers/remoteproc/remoteproc_core.c
> index 364ef28..48b2c5d 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1360,7 +1360,7 @@ static void rproc_type_release(struct device *dev)
>   kfree(rproc);
>  }
>  
> -static struct device_type rproc_type = {
> +static const struct device_type rproc_type = {
>   .name   = "remoteproc",
>   .release= rproc_type_release,
>  };
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/15] [media] i2c: make device_type const

2017-08-24 Thread Guennadi Liakhovetski
On Sat, 19 Aug 2017, Bhumika Goyal wrote:

> Make this const as it is only stored in the type field of a device
> structure, which is const.
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal 

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

> ---
>  drivers/media/i2c/soc_camera/mt9t031.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/mt9t031.c 
> b/drivers/media/i2c/soc_camera/mt9t031.c
> index 714fb35..4802d30 100644
> --- a/drivers/media/i2c/soc_camera/mt9t031.c
> +++ b/drivers/media/i2c/soc_camera/mt9t031.c
> @@ -592,7 +592,7 @@ static int mt9t031_runtime_resume(struct device *dev)
>   .runtime_resume = mt9t031_runtime_resume,
>  };
>  
> -static struct device_type mt9t031_dev_type = {
> +static const struct device_type mt9t031_dev_type = {
>   .name   = "MT9T031",
>   .pm = _dev_pm_ops,
>  };
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 08/15] PCI: make device_type const

2017-08-24 Thread Bjorn Helgaas
On Sat, Aug 19, 2017 at 01:52:19PM +0530, Bhumika Goyal wrote:
> Make this const as it is only stored in the type field of a device
> structure, which is const.
> Done using Coccinelle.
> 
> Signed-off-by: Bhumika Goyal 

Applied to pci/misc for v4.14, thanks!

> ---
>  drivers/pci/endpoint/pci-epf-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/pci-epf-core.c 
> b/drivers/pci/endpoint/pci-epf-core.c
> index 6877d6a..9d0de12 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -27,7 +27,7 @@
>  #include 
>  
>  static struct bus_type pci_epf_bus_type;
> -static struct device_type pci_epf_type;
> +static const struct device_type pci_epf_type;
>  
>  /**
>   * pci_epf_linkup() - Notify the function driver that EPC device has
> @@ -275,7 +275,7 @@ static void pci_epf_dev_release(struct device *dev)
>   kfree(epf);
>  }
>  
> -static struct device_type pci_epf_type = {
> +static const struct device_type pci_epf_type = {
>   .release= pci_epf_dev_release,
>  };
>  
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: Android: fix code style in ion_cma_heap.c

2017-08-24 Thread Laura Abbott
On 08/24/2017 08:40 AM, Abishek V Ashok wrote:
> This is a patch to the ion_cma_heap.c file in
> /drivers/staging/andrioid/ion that fixes a blank line and
> kmalloc size warning found by the checkpatch.pl tool.
> 

You've done two things in this patch, please stick to a single
change per patch.

> Signed-off-by: Abhishek V Ashok 
> ---
>  drivers/staging/android/ion/ion_cma_heap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
> b/drivers/staging/android/ion/ion_cma_heap.c
> index a0949bc0..1589b9e0 100644
> --- a/drivers/staging/android/ion/ion_cma_heap.c
> +++ b/drivers/staging/android/ion/ion_cma_heap.c
> @@ -31,7 +31,6 @@ struct ion_cma_heap {
> 
>  #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
> 
> -
>  /* ION CMA heap operations functions */
>  static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>   unsigned long len,
> @@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
> ion_buffer *buffer,
>   if (!pages)
>   return -ENOMEM;
> 
> - table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> + table = kmalloc(sizeof(struct * table), GFP_KERNEL);
>   if (!table)
>   goto err;
> 
> --
> 2.11.0
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 3/3] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)

2017-08-24 Thread Stefan Hajnoczi
On Tue, Aug 22, 2017 at 09:40:01PM +, Dexuan Cui wrote:
> > From: Stefan Hajnoczi [mailto:stefa...@redhat.com]
> > On Fri, Aug 18, 2017 at 10:23:54PM +, Dexuan Cui wrote:
> > > > > +static bool hvs_stream_allow(u32 cid, u32 port)
> > > > > +{
> > > > > + static const u32 valid_cids[] = {
> > > > > + VMADDR_CID_ANY,
> > > >
> > > > Is this for loopback?
> > >
> > > No, we don't support lookback in Linux VM, at least for now.
> > > In our Linux implementation, Linux VM can only connect to the host, and
> > > here when Linux VM calls connect(), I treat  VMADDR_CID_ANY
> > > the same as VMADDR_CID_HOST.
> > 
> > VMCI and virtio-vsock do not treat connect(VMADDR_CID_ANY) the same as
> > connect(VMADDR_CID_HOST).  It is an error to connect to VMADDR_CID_ANY.
> 
> Ok. Then I'll only allow VMADDR_CID_HOST as the destination CID, since 
> we don't support loopback mode.
> 
> > > > > + /* The host's port range [MIN_HOST_EPHEMERAL_PORT, 0x)
> > > > is
> > > > > +  * reserved as ephemeral ports, which are used as the host's 
> > > > > ports
> > > > > +  * when the host initiates connections.
> > > > > +  */
> > > > > + if (port > MAX_HOST_LISTEN_PORT)
> > > > > + return false;
> > > >
> > > > Without this if statement the guest will attempt to connect.  I guess
> > > > there will be no listen sockets above MAX_HOST_LISTEN_PORT, so the
> > > > connection attempt will fail.
> > >
> > > You're correct.
> > > To use the vsock common infrastructure, we have to map Hyper-V's
> > > GUID  to int , and hence we must limit
> > > the port range we can listen() on to [0, MAX_LISTEN_PORT], i.e.
> > > we can only use half of the whole 32-bit port space for listen().
> > > This is detailed in the long comments starting at about Line 100.
> > >
> > > > ...but hardcode this knowledge into the guest driver?
> > > I'd like the guest's connect() to fail immediately here.
> > > IMO this is better than a connect timeout. :-)
> > 
> > Thanks for explaining.  Perhaps the comment could be updated:
> > 
> >  /* The host's port range [MIN_HOST_EPHEMERAL_PORT, 0x) is
> >   * reserved as ephemeral ports, which are used as the host's ports when
> >   * the host initiates connections.
> >   *
> >   * Perform this check in the guest so an immediate error is produced
> >   * instead of a timeout.
> >   */
> > 
> > Stefan
> 
> Thank you, Stefan! 
> Please see the below for the updated version of the function:
> 
> static bool hvs_stream_allow(u32 cid, u32 port)
> {
> /* The host's port range [MIN_HOST_EPHEMERAL_PORT, 0x) is
>  * reserved as ephemeral ports, which are used as the host's ports
>  * when the host initiates connections.
>  *
>  * Perform this check in the guest so an immediate error is produced
>  * instead of a timeout.
>  */
> if (port > MAX_HOST_LISTEN_PORT)
> return false;
> 
> if (cid == VMADDR_CID_HOST)
> return true;
> 
> return false;
> }
> 
> I'll send a v2 of the patch later today.

Great, thanks!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: Android: fix code style in ion_cma_heap.c

2017-08-24 Thread Abishek V Ashok
This is a patch to the ion_cma_heap.c file in
/drivers/staging/andrioid/ion that fixes a blank line and
kmalloc size warning found by the checkpatch.pl tool.

Signed-off-by: Abhishek V Ashok 
---
 drivers/staging/android/ion/ion_cma_heap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc0..1589b9e0 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -31,7 +31,6 @@ struct ion_cma_heap {

 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)

-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len,
@@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (!pages)
return -ENOMEM;

-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(struct * table), GFP_KERNEL);
if (!table)
goto err;

--
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] staging: olpc_dcon: remove pointless debug printk in dcon_freeze_store()

2017-08-24 Thread Shurong Zhang
This printk doesn't really add anything worthwhile.

Signed-off-by: Shurong Zhang 
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
b/drivers/staging/olpc_dcon/olpc_dcon.c
index f7f3a78..82bffd9 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -456,8 +456,6 @@ static ssize_t dcon_freeze_store(struct device *dev,
if (ret)
return ret;
 
-   pr_info("dcon_freeze_store: %lu\n", output);
-
switch (output) {
case 0:
dcon_set_source(dcon, DCON_SOURCE_CPU);
-- 
2.7.4



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Two rtlwifi drivers?

2017-08-24 Thread Larry Finger

On 08/24/2017 07:14 AM, Kalle Valo wrote:

Dan Carpenter  writes:


Smatch is distrustful of the "capab" value and marks it as user
controlled.  I think it actually comes from the firmware?  Anyway, I
looked at other drivers and they added a bounds check and it seems like
a harmless thing to have so I have added it here as well.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index f7f207cbaee3..a30b928d5ee1 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c


I'm getting slightly annoyed that we now apparently have two duplicate
rtlwifi drivers (with the same name!) and I'm being spammed by staging
patches. Was this really a smart thing to do? And what will be the
future of these two drivers?

(Of course this is not directed to Dan, he is just fixing bugs found by
smatch, but more like a general question.)


That was the decision that you and Greg made. The version in wireless-drivers 
needs many patches to handle the new device. The progress in applying these to 
wireless-drivers was very slow for many reasons. Keeping a single version of 
that code would have required coordination between you and Greg, which was 
discouraged.


The future, as stated in the TODO in staging, is to merge all the changes in the 
support drivers into wireless-drivers, and then move the new RTL8822BE driver 
out of staging.


I'm sorry about the fallout affecting you, and I probably should have changed 
the directory names. In any case, ignore any patches that belong in staging. If 
I see any that do not include GregKH in the "To" list, I will NACK them and 
request proper routing.


Larry
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:rtl8188eu:core Fix Avoid CamelCase

2017-08-24 Thread Dan Carpenter
On Thu, Aug 24, 2017 at 02:58:06PM +0530, Janani Sankara Babu wrote:
> This patch is created to solve the CamelCase issue. The members 'IEs' and
> 'IELength' of struct wlan_bssid_ex are being modified to 'ies' and 
> 'ie_length' to solve the issue. And all the places where these variables
> are referenced inside the rtl8188eu driver are also changed.
> 
> Signed-off-by: Janani Sankara Babu 
> ---
>  drivers/staging/rtl8188eu/core/rtw_ap.c |  89 +++--
>  drivers/staging/rtl8188eu/core/rtw_cmd.c|  26 +++---
>  drivers/staging/rtl8188eu/core/rtw_ieee80211.c  |  20 ++---
>  drivers/staging/rtl8188eu/core/rtw_ioctl_set.c  |   2 +-
>  drivers/staging/rtl8188eu/core/rtw_mlme.c   |  66 
>  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c   | 100 
> 
>  drivers/staging/rtl8188eu/core/rtw_wlan_util.c  |  34 
>  drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c|  16 ++--
>  drivers/staging/rtl8188eu/include/wlan_bssdef.h |  10 +--
>  drivers/staging/rtl8188eu/os_dep/ioctl_linux.c  |  12 +--
>  10 files changed, 189 insertions(+), 186 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
> b/drivers/staging/rtl8188eu/core/rtw_ap.c
> index 647a922..2cd20f1 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ap.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
> @@ -69,19 +69,22 @@ static void update_BCNTIM(struct adapter *padapter)
>   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
>   struct mlme_ext_info *pmlmeinfo = >mlmext_info;
>   struct wlan_bssid_ex *pnetwork_mlmeext = >network;
> - unsigned char *pie = pnetwork_mlmeext->IEs;
> + //unsigned char *pie = pnetwork_mlmeext->ies;
> + unsigned char *pie = pnetwork_mlmeext->ies;

Why did you comment this out?  Really "ie" is a better name that "ies".
The "s" was supposed to make it plural but that's not obvious in the
new code.

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: olpc_dcon: remove pointless debug printk in dcon_freeze_store()

2017-08-24 Thread Dan Carpenter
On Thu, Aug 24, 2017 at 02:10:37PM +0800, Shurong Zhang wrote:
> This printk doesn't really add anything worthwhile.
> 
> Signed-off-by: Shurong Zhang 
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
> b/drivers/staging/olpc_dcon/olpc_dcon.c
> index f7f3a78..f9d9465 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -456,7 +456,6 @@ static ssize_t dcon_freeze_store(struct device *dev,
>   if (ret)
>   return ret;
>  
> - pr_info("dcon_freeze_store: %lu\n", output);
>  

Delete a blank line as well.  We don't allow two blank lines in a row.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Two rtlwifi drivers?

2017-08-24 Thread Kalle Valo
Dan Carpenter  writes:

> Smatch is distrustful of the "capab" value and marks it as user
> controlled.  I think it actually comes from the firmware?  Anyway, I
> looked at other drivers and they added a bounds check and it seems like
> a harmless thing to have so I have added it here as well.
>
> Signed-off-by: Dan Carpenter 
>
> diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
> index f7f207cbaee3..a30b928d5ee1 100644
> --- a/drivers/staging/rtlwifi/base.c
> +++ b/drivers/staging/rtlwifi/base.c

I'm getting slightly annoyed that we now apparently have two duplicate
rtlwifi drivers (with the same name!) and I'm being spammed by staging
patches. Was this really a smart thing to do? And what will be the
future of these two drivers?

(Of course this is not directed to Dan, he is just fixing bugs found by
smatch, but more like a general question.)

-- 
Kalle Valo
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtlwifi: check for array overflow

2017-08-24 Thread Dan Carpenter
Smatch is distrustful of the "capab" value and marks it as user
controlled.  I think it actually comes from the firmware?  Anyway, I
looked at other drivers and they added a bounds check and it seems like
a harmless thing to have so I have added it here as well.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index f7f207cbaee3..a30b928d5ee1 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -1414,6 +1414,10 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx)
  le16_to_cpu(mgmt->u.action.u.addba_req.capab);
tid = (capab &
   IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+   if (tid >= MAX_TID_COUNT) {
+   rcu_read_unlock();
+   return true;
+   }
tid_data = _entry->tids[tid];
if (tid_data->agg.rx_agg_state ==
RTL_RX_AGG_START)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:rtl8188eu:core Fix Avoid CamelCase

2017-08-24 Thread Janani Sankara Babu
This patch is created to solve the CamelCase issue. The members 'IEs' and
'IELength' of struct wlan_bssid_ex are being modified to 'ies' and 
'ie_length' to solve the issue. And all the places where these variables
are referenced inside the rtl8188eu driver are also changed.

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c |  89 +++--
 drivers/staging/rtl8188eu/core/rtw_cmd.c|  26 +++---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c  |  20 ++---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c  |   2 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c   |  66 
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c   | 100 
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c  |  34 
 drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c|  16 ++--
 drivers/staging/rtl8188eu/include/wlan_bssdef.h |  10 +--
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c  |  12 +--
 10 files changed, 189 insertions(+), 186 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 647a922..2cd20f1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -69,19 +69,22 @@ static void update_BCNTIM(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = >mlmext_info;
struct wlan_bssid_ex *pnetwork_mlmeext = >network;
-   unsigned char *pie = pnetwork_mlmeext->IEs;
+   //unsigned char *pie = pnetwork_mlmeext->ies;
+   unsigned char *pie = pnetwork_mlmeext->ies;
u8 *p, *dst_ie, *premainder_ie = NULL;
u8 *pbackup_remainder_ie = NULL;
uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
 
/* update TIM IE */
+   //p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, _ielen,
+   //pnetwork_mlmeext->ie_length - _FIXED_IE_LENGTH_);
p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, _ielen,
-   pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
+   pnetwork_mlmeext->ie_length - _FIXED_IE_LENGTH_);
if (p && tim_ielen > 0) {
tim_ielen += 2;
premainder_ie = p + tim_ielen;
tim_ie_offset = (int)(p - pie);
-   remainder_ielen = pnetwork_mlmeext->IELength -
+   remainder_ielen = pnetwork_mlmeext->ie_length -
tim_ie_offset - tim_ielen;
/* append TIM IE from dst_ie offset */
dst_ie = p;
@@ -94,7 +97,7 @@ static void update_BCNTIM(struct adapter *padapter)
 
/*  get supported rates len */
p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_,
-  _len, (pnetwork_mlmeext->IELength -
+  _len, (pnetwork_mlmeext->ie_length -
  _BEACON_IE_OFFSET_));
if (p)
offset += tmp_len+2;
@@ -104,7 +107,7 @@ static void update_BCNTIM(struct adapter *padapter)
 
premainder_ie = pie + offset;
 
-   remainder_ielen = pnetwork_mlmeext->IELength -
+   remainder_ielen = pnetwork_mlmeext->ie_length -
offset - tim_ielen;
 
/* append TIM IE from offset */
@@ -119,7 +122,7 @@ static void update_BCNTIM(struct adapter *padapter)
}
*dst_ie++ = _TIM_IE_;
 
-   if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc))
+   if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fc))
tim_ielen = 5;
else
tim_ielen = 4;
@@ -129,7 +132,7 @@ static void update_BCNTIM(struct adapter *padapter)
*dst_ie++ = 0;/* DTIM count */
*dst_ie++ = 1;/* DTIM period */
 
-   if (pstapriv->tim_bitmap(0))/* for bc/mc frames */
+   if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */
*dst_ie++ = BIT(0);/* bitmap ctrl */
else
*dst_ie++ = 0;
@@ -148,7 +151,7 @@ static void update_BCNTIM(struct adapter *padapter)
kfree(pbackup_remainder_ie);
}
offset =  (uint)(dst_ie - pie);
-   pnetwork_mlmeext->IELength = offset + remainder_ielen;
+   pnetwork_mlmeext->ie_length = offset + remainder_ielen;
 
set_tx_beacon_cmd(padapter);
 }
@@ -158,13 +161,13 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct 
wlan_bssid_ex *pnetwork,
 {
struct ndis_802_11_var_ie *pIE;
u8 bmatch = false;
-   u8 *pie = pnetwork->IEs;
+   u8 *pie = pnetwork->ies;
u8 *p = NULL, *dst_ie = NULL, *premainder_ie = NULL;
u8 *pbackup_remainder_ie = NULL;
u32 i, offset, ielen = 0, ie_offset, remainder_ielen = 0;
 
-   for (i = sizeof(struct ndis_802_11_fixed_ie); i < 

[PATCH] staging:rtl8188eu:core Fix add spaces around

2017-08-24 Thread Janani Sankara Babu
This patch is created to solve the following coding style issue reported
by the checkpatch script.
CHECK: spaces preffered around that '&' (ctx:VxV)

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 647a922..66d4e6c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -119,7 +119,7 @@ static void update_BCNTIM(struct adapter *padapter)
}
*dst_ie++ = _TIM_IE_;
 
-   if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc))
+   if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fc))
tim_ielen = 5;
else
tim_ielen = 4;
@@ -129,7 +129,7 @@ static void update_BCNTIM(struct adapter *padapter)
*dst_ie++ = 0;/* DTIM count */
*dst_ie++ = 1;/* DTIM period */
 
-   if (pstapriv->tim_bitmap(0))/* for bc/mc frames */
+   if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */
*dst_ie++ = BIT(0);/* bitmap ctrl */
else
*dst_ie++ = 0;
@@ -583,7 +583,7 @@ static void update_bmc_sta(struct adapter *padapter)
{
u8 arg = 0;
 
-   arg = psta->mac_id&0x1f;
+   arg = psta->mac_id & 0x1f;
arg |= BIT(7);
tx_ra_bitmap |= ((raid << 28) & 0xf000);
DBG_88E("update_bmc_sta, mask = 0x%x, arg = 0x%x\n", 
tx_ra_bitmap, arg);
@@ -1043,7 +1043,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 
*pbuf,  int len)
(psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP))
pht_cap->ampdu_params_info |= 
(IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2));
else
-   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
+   pht_cap->ampdu_params_info |= 
(IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
 
/* set  Max Rx AMPDU size  to 64K */
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 
0x03);
@@ -1719,7 +1719,7 @@ int rtw_sta_flush(struct adapter *padapter)
 
DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
 
-   if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
+   if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)
return 0;
 
spin_lock_bh(>asoc_list_lock);
@@ -1754,7 +1754,7 @@ void sta_info_update(struct adapter *padapter, struct 
sta_info *psta)
struct mlme_priv *pmlmepriv = >mlmepriv;
 
/* update wmm cap. */
-   if (WLAN_STA_WME)
+   if (WLAN_STA_WME & flags)
psta->qos_option = 1;
else
psta->qos_option = 0;
@@ -1763,7 +1763,7 @@ void sta_info_update(struct adapter *padapter, struct 
sta_info *psta)
psta->qos_option = 0;
 
/* update 802.11n ht cap. */
-   if (WLAN_STA_HT) {
+   if (WLAN_STA_HT & flags) {
psta->htpriv.ht_option = true;
psta->qos_option = 1;
} else {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:rtl8188eu:core Fix coding style Issues

2017-08-24 Thread Janani Sankara Babu
This patch solves the following warning shown by the checkpatch script
WARNING: Comparisons should place the constants on the right side of
the test

Signed-off-by: Janani Sankara Babu 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index d8d88b5..767928a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -56,7 +56,7 @@ u8 rtw_do_join(struct adapter *padapter)
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, 
("rtw_do_join(): site survey if scanned_queue is empty\n."));
/*  submit site_survey_cmd */
ret = rtw_sitesurvey_cmd(padapter, 
>assoc_ssid, 1, NULL, 0);
-   if (_SUCCESS != ret) {
+   if (ret != _SUCCESS) {
pmlmepriv->to_join = false;
RT_TRACE(_module_rtl871x_ioctl_set_c_, 
_drv_err_, ("rtw_do_join(): site survey return error\n."));
}
@@ -110,7 +110,7 @@ u8 rtw_do_join(struct adapter *padapter)
if (!pmlmepriv->LinkDetectInfo.bBusyTraffic ||
pmlmepriv->to_roaming > 0) {
ret = rtw_sitesurvey_cmd(padapter, 
>assoc_ssid, 1, NULL, 0);
-   if (_SUCCESS != ret) {
+   if (ret != _SUCCESS) {
pmlmepriv->to_join = false;

RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("do_join(): site survey 
return error\n."));
}
@@ -621,7 +621,7 @@ int rtw_set_country(struct adapter *adapter, const char 
*country_code)
 
DBG_88E("%s country_code:%s\n", __func__, country_code);
for (i = 0; i < ARRAY_SIZE(channel_table); i++) {
-   if (0 == strcmp(channel_table[i].name, country_code)) {
+   if (strcmp(channel_table[i].name, country_code) == 0) {
channel_plan = channel_table[i].channel_plan;
break;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next v3 2/7] netvsc: fix warnings reported by lockdep

2017-08-24 Thread David Woodhouse
On Fri, 2017-07-28 at 08:59 -0700, Stephen Hemminger wrote:
> This includes a bunch of fixups for issues reported by
> lockdep.
>    * ethtool routines can assume RTNL
>    * send is done with RCU lock (and BH disable)
>    * avoid refetching internal device struct (netvsc)
>  instead pass it as a parameter.
> 
> Signed-off-by: Stephen Hemminger 

The subject and the commit message are inconsistent — is this fixing
*warnings* (i.e. shut up a false positive), or is it fixing *issues*?
It looks like it's actually fixing issues, not just warnings?

It's really useful to get that right.

FWIW the reason I'm looking in my netdev@ folder for lockdep warning
fixes is because I was trying to confirm whether the commit message in
https://patchwork.kernel.org/patch/4372391/ is actually telling the
truth or not — in that case I think it *is* just a false positive being
shut up (and thus it's OK to say "fix warning"), not really fixing a
true issue.

smime.p7s
Description: S/MIME cryptographic signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: olpc_dcon: remove pointless debug printk in dcon_freeze_store()

2017-08-24 Thread Shurong Zhang
This printk doesn't really add anything worthwhile.

Signed-off-by: Shurong Zhang 
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c 
b/drivers/staging/olpc_dcon/olpc_dcon.c
index f7f3a78..f9d9465 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -456,7 +456,6 @@ static ssize_t dcon_freeze_store(struct device *dev,
if (ret)
return ret;
 
-   pr_info("dcon_freeze_store: %lu\n", output);
 
switch (output) {
case 0:
-- 
2.7.4



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel