Re: [PATCH] staging: lustre: llite: replace variable length array

2018-01-29 Thread Dilger, Andreas
On Jan 27, 2018, at 14:42, Sven Dziadek  wrote:
> 
> The functionality of the removed variable length array is already
> implemented by the function xattr_full_name in fs/xattr.c
> 
> This fixes the sparse warning:
> warning: Variable length array is used.
> 
> Signed-off-by: Sven Dziadek 
> ---
> drivers/staging/lustre/lustre/llite/xattr.c | 12 
> 1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/xattr.c 
> b/drivers/staging/lustre/lustre/llite/xattr.c
> index 532384c91447..4fd28213c6a1 100644
> --- a/drivers/staging/lustre/lustre/llite/xattr.c
> +++ b/drivers/staging/lustre/lustre/llite/xattr.c
> @@ -87,7 +87,6 @@ ll_xattr_set_common(const struct xattr_handler *handler,
>   const char *name, const void *value, size_t size,
>   int flags)
> {
> - char fullname[strlen(handler->prefix) + strlen(name) + 1];
>   struct ll_sb_info *sbi = ll_i2sbi(inode);
>   struct ptlrpc_request *req = NULL;
>   const char *pv = value;
> @@ -141,9 +140,8 @@ ll_xattr_set_common(const struct xattr_handler *handler,
>   return -EPERM;
>   }
> 
> - sprintf(fullname, "%s%s\n", handler->prefix, name);
> - rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
> -  valid, fullname, pv, size, 0, flags,
> + rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid,
> +  xattr_full_name(handler, name), pv, size, 0, flags,
>ll_i2suppgid(inode), &req);

Hi Sven,
thanks for the patch.

Looking at the details of "xattr_full_name()", this seems quite risky.  This
is essentially returning the pointer _before_ "name" on the assumption that
it contains the full "prefix.name" string.  IMHO, that is not necessarily a
safe assumption to make several layers down in the code.

James, I thought you had a patch for this to use kasprintf() instead of the
on-stack "fullname" declaration?

Cheers, Andreas

>   if (rc) {
>   if (rc == -EOPNOTSUPP && handler->flags == XATTR_USER_T) {
> @@ -364,7 +362,6 @@ static int ll_xattr_get_common(const struct xattr_handler 
> *handler,
>  struct dentry *dentry, struct inode *inode,
>  const char *name, void *buffer, size_t size)
> {
> - char fullname[strlen(handler->prefix) + strlen(name) + 1];
>   struct ll_sb_info *sbi = ll_i2sbi(inode);
> #ifdef CONFIG_FS_POSIX_ACL
>   struct ll_inode_info *lli = ll_i2info(inode);
> @@ -411,9 +408,8 @@ static int ll_xattr_get_common(const struct xattr_handler 
> *handler,
>   if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
>   return -ENODATA;
> #endif
> - sprintf(fullname, "%s%s\n", handler->prefix, name);
> - return ll_xattr_list(inode, fullname, handler->flags, buffer, size,
> -  OBD_MD_FLXATTR);
> + return ll_xattr_list(inode, xattr_full_name(handler, name),
> +  handler->flags, buffer, size, OBD_MD_FLXATTR);
> }
> 
> static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t 
> buf_size)
> -- 
> 2.11.0
> 

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







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


Re: [PATCH] staging: lustre: lnet: return of an error code should be negative

2018-01-29 Thread Dilger, Andreas
On Jan 27, 2018, at 22:24, Sumit Pundir  wrote:
> 
> Return value of error codes should typically be negative.
> Issue reported by checkpatch.pl
> 
> Signed-off-by: Sumit Pundir 

Reviewed-by: Andreas Dilger 

> ---
> drivers/staging/lustre/lnet/selftest/framework.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
> b/drivers/staging/lustre/lnet/selftest/framework.c
> index c7697f6..0ca1e3a 100644
> --- a/drivers/staging/lustre/lnet/selftest/framework.c
> +++ b/drivers/staging/lustre/lnet/selftest/framework.c
> @@ -187,7 +187,7 @@ sfw_del_session_timer(void)
>   return 0;
>   }
> 
> - return EBUSY; /* racing with sfw_session_expired() */
> + return -EBUSY; /* racing with sfw_session_expired() */
> }
> 
> static void
> -- 
> 2.7.4
> 

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







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


Re: [PATCH v4 5/7] x86/irq: Count Hyper-V reenlightenment interrupts

2018-01-29 Thread Thomas Gleixner
On Wed, 24 Jan 2018, Radim Krčmář wrote:

> 2018-01-24 14:23+0100, Vitaly Kuznetsov:
> > Hyper-V reenlightenment interrupts arrive when the VM is migrated, we're
> > not supposed to see many of them. However, it may be important to know
> > that the event has happened in case we have L2 nested guests.
> > 
> > Signed-off-by: Vitaly Kuznetsov 
> > Reviewed-by: Thomas Gleixner 
> > ---
> 
> Thomas,
> 
> I think the expectation is that this series will go through the KVM
> tree.  Would you prefer a topic branch?

Is there any dependency outside of plain 4.15? If not, I'll put it into
x86/hyperv and let KVM folks pull it over.

Thanks,

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


Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

2018-01-29 Thread kbuild test robot
Hi Ajay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[cannot apply to v4.15 next-20180126]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ajay-Singh/fix-to-remove-unnecessary-parenthesis-typedef-and-avoid-camelCase/20180123-115314

New smatch warnings:
drivers/staging/wilc1000/host_interface.c:937 handle_connect() error: potential 
null dereference 'hif_drv->usr_conn_req.ssid'.  (kmalloc returns null)

Old smatch warnings:
drivers/staging/wilc1000/host_interface.c:514 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->auth_timeout < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:583 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->rts_threshold < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:636 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->beacon_interval < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:677 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->site_survey_scan_time < 65536) => (0-u16max < 
65536)'
drivers/staging/wilc1000/host_interface.c:691 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->active_scan_time < 65536) => (0-u16max < 
65536)'
drivers/staging/wilc1000/host_interface.c:705 handle_cfg_param() warn: always 
true condition '(cfg_param_attr->passive_scan_time < 65536) => (0-u16max < 
65536)'

vim +937 drivers/staging/wilc1000/host_interface.c

c5c77ba1 Johnny Kim   2015-05-11   903  
e554a305 Leo Kim  2015-11-19   904  u8 wilc_connected_ssid[6] = {0};
cd1931cf Ajay Singh   2018-01-22   905  static s32 handle_connect(struct 
wilc_vif *vif,
3891285c Ajay Singh   2018-01-22   906struct 
connect_attr *attr)
c5c77ba1 Johnny Kim   2015-05-11   907  {
31390eec Leo Kim  2015-10-19   908  s32 result = 0;
5a99cdf9 Ajay Singh   2018-01-22   909  struct wid wid_list[8];
7046f41b Ajay Singh   2018-01-22   910  u32 wid_cnt = 0, dummyval = 0;
44ea7461 Ajay Singh   2018-01-22   911  u8 *cur_byte = NULL;
5e18dd82 Ajay Singh   2018-01-22   912  struct join_bss_param 
*bss_param;
71130e81 Glen Lee 2015-12-21   913  struct host_if_drv *hif_drv = 
vif->hif_drv;
c5c77ba1 Johnny Kim   2015-05-11   914  
3891285c Ajay Singh   2018-01-22   915  if (memcmp(attr->bssid, 
wilc_connected_ssid, ETH_ALEN) == 0) {
31390eec Leo Kim  2015-10-19   916  result = 0;
b92f9304 Chris Park   2016-02-22   917  netdev_err(vif->ndev, 
"Discard connect request\n");
31390eec Leo Kim  2015-10-19   918  return result;
c5c77ba1 Johnny Kim   2015-05-11   919  }
c5c77ba1 Johnny Kim   2015-05-11   920  
5e18dd82 Ajay Singh   2018-01-22   921  bss_param = attr->params;
5e18dd82 Ajay Singh   2018-01-22   922  if (!bss_param) {
b92f9304 Chris Park   2016-02-22   923  netdev_err(vif->ndev, 
"Required BSSID not found\n");
31390eec Leo Kim  2015-10-19   924  result = -ENOENT;
24db713f Leo Kim  2015-09-16   925  goto ERRORHANDLER;
c5c77ba1 Johnny Kim   2015-05-11   926  }
c5c77ba1 Johnny Kim   2015-05-11   927  
3891285c Ajay Singh   2018-01-22   928  if (attr->bssid) {
788f6fc0 Chaehyun Lim 2016-02-12   929  
hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
3891285c Ajay Singh   2018-01-22   930  
memcpy(hif_drv->usr_conn_req.bssid, attr->bssid, 6);
c5c77ba1 Johnny Kim   2015-05-11   931  }
c5c77ba1 Johnny Kim   2015-05-11   932  
3891285c Ajay Singh   2018-01-22   933  hif_drv->usr_conn_req.ssid_len 
= attr->ssid_len;
3891285c Ajay Singh   2018-01-22   934  if (attr->ssid) {
3891285c Ajay Singh   2018-01-22   935  
hif_drv->usr_conn_req.ssid = kmalloc(attr->ssid_len + 1, GFP_KERNEL);
3891285c Ajay Singh   2018-01-22   936  
memcpy(hif_drv->usr_conn_req.ssid, attr->ssid, attr->ssid_len);
3891285c Ajay Singh   2018-01-22  @937  
hif_drv->usr_conn_req.ssid[attr->ssid_len] = '\0';
c5c77ba1 Johnny Kim   2015-05-11   938  }
c5c77ba1 Johnny Kim   2015-05-11   939  
3891285c Ajay Singh   2018-01-22   940  hif_drv->usr_conn_req.ies_len = 
attr->ies_len;
3891285c Ajay Singh   2018-01-22   941  if (attr->ies) {
3891285c Ajay Singh   2018-01-22   942  
hif_drv->usr_conn_req.ies = kmalloc(attr->ies_len, GFP_KERNEL);
3891285c Ajay Singh   2018-01-22   943  
memcpy(hif_drv->usr_conn_req.ies, attr->ies, attr->ies_len);
c5c77ba1 Johnny Kim   2015-05-11   944  }
c5c77ba1 Johnny Kim   2015-05-11   945  
3891285c Ajay Singh   2018-01-22   946  hif_drv->usr_conn_req.security 
= attr->security;
3891285c Ajay Singh   

[PATCH v4 char-misc 1/1] Drivers: hv: vmbus: Implement Direct Mode for stimer0

2018-01-29 Thread Michael Kelley (EOSG)
From: Michael Kelley 

The 2016 version of Hyper-V offers the option to operate the guest VM
per-vcpu stimer's in Direct Mode, which means the timer interupts on its
own vector rather than queueing a VMbus message. Direct Mode reduces
timer processing overhead in both the hypervisor and the guest, and
avoids having timer interrupts pollute the VMbus interrupt stream for
the synthetic NIC and storage.  This patch enables Direct Mode by
default on stimer0 when running on a version of Hyper-V that supports
it.

In prep for coming support of Hyper-V on ARM64, the arch independent
portion of the code contains calls to routines that will be populated
on ARM64 but are not needed and do nothing on x86.

Signed-off-by: Michael Kelley 
---
Changes since v1:
* Major rework to allocate and use a fixed interrupt vector
* Fixed block comment style
* Removed minor changes unrelated to Direct Mode

Changes since v2:
* Remove module parameter in drivers/hv/hv.c [Greg KH]
* Add declaration for hv_stimer0_vector_handler in mshyperv.h 

Changes since v3:
* Remove vestiges of module parameter in commit message and
  #include list in hv.c [Greg KH]

---
 arch/x86/entry/entry_32.S  |  3 ++
 arch/x86/entry/entry_64.S  |  2 ++
 arch/x86/include/asm/hardirq.h |  3 ++
 arch/x86/include/asm/irq_vectors.h |  7 -
 arch/x86/include/asm/mshyperv.h| 13 
 arch/x86/include/uapi/asm/hyperv.h |  3 ++
 arch/x86/kernel/cpu/mshyperv.c | 41 -
 arch/x86/kernel/irq.c  |  9 ++
 drivers/hv/hv.c| 61 --
 drivers/hv/hyperv_vmbus.h  |  4 ++-
 10 files changed, 141 insertions(+), 5 deletions(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index ace8f32..1814991 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -882,6 +882,9 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, 
HYPERVISOR_CALLBACK_VECTOR,
 BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
 hyperv_vector_handler)
 
+BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR,
+hv_stimer0_vector_handler)
+
 #endif /* CONFIG_HYPERV */
 
 ENTRY(page_fault)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index f048e38..23afac9 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1227,6 +1227,8 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
 #if IS_ENABLED(CONFIG_HYPERV)
 apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
hyperv_callback_vector hyperv_vector_handler
+apicinterrupt3 HYPERV_STIMER0_VECTOR \
+   hv_stimer0_callback_vector hv_stimer0_vector_handler
 #endif /* CONFIG_HYPERV */
 
 idtentry debug do_debughas_error_code=0
paranoid=1 shift_ist=DEBUG_STACK
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 51cc979..c788343 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -38,6 +38,9 @@
 #if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
unsigned int irq_hv_callback_count;
 #endif
+#if IS_ENABLED(CONFIG_HYPERV)
+   unsigned int hyperv_stimer0_count;
+#endif
 } cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/x86/include/asm/irq_vectors.h 
b/arch/x86/include/asm/irq_vectors.h
index 67421f6..6accf0b 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -103,7 +103,12 @@
 #endif
 
 #define MANAGED_IRQ_SHUTDOWN_VECTOR0xef
-#define LOCAL_TIMER_VECTOR 0xee
+
+#if IS_ENABLED(CONFIG_HYPERV)
+#define HYPERV_STIMER0_VECTOR  0xee
+#endif
+
+#define LOCAL_TIMER_VECTOR 0xed
 
 #define NR_VECTORS  256
 
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index b623a42..5a170e5 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -171,6 +171,19 @@ static inline void vmbus_signal_eom(struct hv_message 
*msg, u32 old_msg_type)
 void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
 void hv_remove_crash_handler(void);
 
+/*
+ * Routines for stimer0 Direct Mode handling.
+ * On x86/x64, there are no percpu actions to take.
+ */
+void hv_stimer0_vector_handler(struct pt_regs *regs);
+void hv_stimer0_callback_vector(void);
+int hv_setup_stimer0_irq(int *irq, int *vector, void (*handler)(void));
+void hv_remove_stimer0_irq(int irq);
+
+static inline void hv_enable_stimer0_percpu_irq(int irq) {}
+static inline void hv_disable_stimer0_percpu_irq(int irq) {}
+
+
 #if IS_ENABLED(CONFIG_HYPERV)
 extern struct clocksource *hyperv_cs;
 extern void *hv_hypercall_pg;
diff --git a/arch/x86/include/uapi/asm/hyperv.h 
b/arch/x86/include/uapi/asm/hyperv.h
index 1a5bfea..7213cb8 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -74,6 +74,9 @@
 /* Crash M

[PATCH] Staging: iio: ade7758: Remove iio_dev mlock

2018-01-29 Thread Shreeya Patel
In the ade7758 file, read raw does not require iio_dev->mlock for
reads. It can run concurrently as resource protection is handled
by buf_lock in ade7758_spi_read_reg_8()

Signed-off-by: Shreeya Patel 
---
 drivers/staging/iio/meter/ade7758_core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7758_core.c 
b/drivers/staging/iio/meter/ade7758_core.c
index 7b7ffe5..227dbfc 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -526,9 +526,7 @@ static int ade7758_read_raw(struct iio_dev *indio_dev,
 
switch (mask) {
case IIO_CHAN_INFO_SAMP_FREQ:
-   mutex_lock(&indio_dev->mlock);
ret = ade7758_read_samp_freq(&indio_dev->dev, val);
-   mutex_unlock(&indio_dev->mlock);
return ret;
default:
return -EINVAL;
-- 
2.7.4

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


Re: [PATCH] staging: media: atomisp2: remove unused headers

2018-01-29 Thread LABBE Corentin
On Mon, Jan 29, 2018 at 03:22:33PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 29, 2018 at 3:11 PM, Corentin Labbe  wrote:
> > All thoses headers are not used by any source files.
> > Lets just remove them.
> 
> How did you test this?
> 
> P.S. I like the patch, but since driver in a state of coma vigil, I'm
> afraid you may do something which shouldn't be done for working
> driver.
> 

For testing I have:
- successfully compiling the driver
- for each file, grepping its name in tree to be sure that no one uses it.

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


Re: [PATCH] staging: media: atomisp2: remove unused headers

2018-01-29 Thread Andy Shevchenko
On Mon, Jan 29, 2018 at 3:11 PM, Corentin Labbe  wrote:
> All thoses headers are not used by any source files.
> Lets just remove them.

How did you test this?

P.S. I like the patch, but since driver in a state of coma vigil, I'm
afraid you may do something which shouldn't be done for working
driver.

-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: media: remove remains of VIDEO_ATOMISP_OV8858

2018-01-29 Thread Andy Shevchenko
On Mon, 2018-01-29 at 12:16 +, Corentin Labbe wrote:
> OV8858 files are left unusable since commit 3a81c7660f80 ("media:
> staging: atomisp: Remove IMX sensor support")
> They are uncompilable since they depends on dw9718.c and vcm.c which
> was removed.
> 
> Remove the OV8858 kconfig and files.

Fine with me. We can sort things out later (repository will have the
sources still in any case) when the driver itself shows signs of life.

-- 
Andy Shevchenko 
Intel Finland Oy
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel