[PATCH v3] staging: gdm72xx: add userspace data struct

2015-12-11 Thread Wim de With
This fixes the sparse warnings about dereferencing a userspace pointer.

Once I updated the sparse annotations, I noticed a bug in
gdm_wimax_ioctl() where we pass a user space pointer to gdm_update_fsm()
which dereferences it. I fixed this.

Signed-off-by: Wim de With <nauxu...@wimdewith.com>
---
 drivers/staging/gdm72xx/gdm_wimax.c | 12 
 drivers/staging/gdm72xx/wm_ioctl.h  |  7 ++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index d9ddced..5da9ad9 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -368,7 +368,7 @@ static void kdelete(void **buf)
}
 }
 
-static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_get_data(struct udata_s *dst, struct data_s *src)
 {
int size;
 
@@ -384,7 +384,7 @@ static int gdm_wimax_ioctl_get_data(struct data_s *dst, 
struct data_s *src)
return 0;
 }
 
-static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct udata_s *src)
 {
if (!src->size) {
dst->size = 0;
@@ -460,6 +460,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
struct wm_req_s *req = (struct wm_req_s *)ifr;
struct nic *nic = netdev_priv(dev);
int ret;
+   struct fsm_s fsm_buf;
 
if (cmd != SIOCWMIOCTL)
return -EOPNOTSUPP;
@@ -482,8 +483,11 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
/* NOTE: gdm_update_fsm should be called
 * before gdm_wimax_ioctl_set_data is called.
 */
-   gdm_update_fsm(dev,
-  req->data.buf);
+   if (copy_from_user(_buf, req->data.buf,
+  sizeof(struct fsm_s)))
+   return -EFAULT;
+
+   gdm_update_fsm(dev, _buf);
}
ret = gdm_wimax_ioctl_set_data(
>sdk_data[req->data_id], >data);
diff --git a/drivers/staging/gdm72xx/wm_ioctl.h 
b/drivers/staging/gdm72xx/wm_ioctl.h
index ed8f649..631cb1d 100644
--- a/drivers/staging/gdm72xx/wm_ioctl.h
+++ b/drivers/staging/gdm72xx/wm_ioctl.h
@@ -78,13 +78,18 @@ struct data_s {
void*buf;
 };
 
+struct udata_s {
+   int size;
+   void __user *buf;
+};
+
 struct wm_req_s {
union {
char ifrn_name[IFNAMSIZ];
} ifr_ifrn;
unsigned short  cmd;
unsigned short  data_id;
-   struct data_s   data;
+   struct udata_s  data;
 
 /* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */
 };
-- 
2.6.3

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


Re: [PATCH] staging: gdm72xx: add userspace data struct

2015-12-10 Thread Wim de With
On 10-12-2015 10:37, Dan Carpenter wrote:
> On Thu, Dec 10, 2015 at 10:11:12AM +0100, Wim de With wrote:
>> @@ -482,8 +483,16 @@ static int gdm_wimax_ioctl(struct net_device *dev, 
>> struct ifreq *ifr, int cmd)
>>  /* NOTE: gdm_update_fsm should be called
>>   * before gdm_wimax_ioctl_set_data is called.
>>   */
>> -gdm_update_fsm(dev,
>> -   req->data.buf);
>> +fsm_buf = kmalloc(sizeof(fsm_s), GFP_KERNEL);
>> +if (!fsm_buf)
>> +return -ENOMEM;
>> +if (copy_from_user(fsm_buf, req->data.buf,
>> +   sizeof(fsm_s))) {
>> +kfree(fsm_buf);
>> +return -EFAULT;
>> +}
>> +gdm_update_fsm(dev, fsm_buf);
>> +kfree(fsm_buf);
> 
> 
> No.  This change is a bug.
> 
> regards,
> dan carpenter
> 

But what if I just keep it as:

gdm_update_fsm(dev, req->data.buf)

Then it would just trust a __user pointer right?

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


[PATCH] staging: gdm72xx: add userspace data struct

2015-12-10 Thread Wim de With
This fixes the sparse warnings about dereferencing a userspace pointer.

However, gdm_wimax_ioctl_get_data and gdm_wimax_ioctl_set_data both
carefully check whether the pointers and data are valid, gdm_update_fsm
does not. It simply casts userspace data to struct fsm_s. I haven't
fixed this, and am not sure what to do about it.

Signed-off-by: Wim de With <nauxu...@wimdewith.com>
---
 drivers/staging/gdm72xx/gdm_wimax.c | 17 +
 drivers/staging/gdm72xx/wm_ioctl.h  |  7 ++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index d9ddced..16eac61 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -368,7 +368,7 @@ static void kdelete(void **buf)
}
 }
 
-static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_get_data(struct udata_s *dst, struct data_s *src)
 {
int size;
 
@@ -384,7 +384,7 @@ static int gdm_wimax_ioctl_get_data(struct data_s *dst, 
struct data_s *src)
return 0;
 }
 
-static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct udata_s *src)
 {
if (!src->size) {
dst->size = 0;
@@ -460,6 +460,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
struct wm_req_s *req = (struct wm_req_s *)ifr;
struct nic *nic = netdev_priv(dev);
int ret;
+   void *fsm_buf;
 
if (cmd != SIOCWMIOCTL)
return -EOPNOTSUPP;
@@ -482,8 +483,16 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
/* NOTE: gdm_update_fsm should be called
 * before gdm_wimax_ioctl_set_data is called.
 */
-   gdm_update_fsm(dev,
-  req->data.buf);
+   fsm_buf = kmalloc(sizeof(fsm_s), GFP_KERNEL);
+   if (!fsm_buf)
+   return -ENOMEM;
+   if (copy_from_user(fsm_buf, req->data.buf,
+  sizeof(fsm_s))) {
+   kfree(fsm_buf);
+   return -EFAULT;
+   }
+   gdm_update_fsm(dev, fsm_buf);
+   kfree(fsm_buf);
}
ret = gdm_wimax_ioctl_set_data(
>sdk_data[req->data_id], >data);
diff --git a/drivers/staging/gdm72xx/wm_ioctl.h 
b/drivers/staging/gdm72xx/wm_ioctl.h
index ed8f649..631cb1d 100644
--- a/drivers/staging/gdm72xx/wm_ioctl.h
+++ b/drivers/staging/gdm72xx/wm_ioctl.h
@@ -78,13 +78,18 @@ struct data_s {
void*buf;
 };
 
+struct udata_s {
+   int size;
+   void __user *buf;
+};
+
 struct wm_req_s {
union {
char ifrn_name[IFNAMSIZ];
} ifr_ifrn;
unsigned short  cmd;
unsigned short  data_id;
-   struct data_s   data;
+   struct udata_s  data;
 
 /* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */
 };
-- 
2.6.3

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


Re: [PATCH v2] staging: gdm72xx: add userspace data struct

2015-12-10 Thread Wim de With
On Thu, Dec 10, 2015 at 02:44:45PM +, One Thousand Gnomes wrote:
> (except that you mean sizeof(struct fsm_s) and it doesn't compile at the
> moment!

Oops, sloppy mistake.

> data_s can just be modified to be __user. All uses of it follow that
> rule.

What do you mean? The data still needs to be copied from user space to kernel
space, if I'm not mistaken. And not all uses follow that rule, since in both
gdm_wimax_ioctl_get_data() and gdm_wimax_ioctl_set_data() it is used as both
the source and destination in the copy_from_user() and copy_to_user() call.

> All I think you need in this case is
> 
>   struct fsm_s fsm_buf;
> 
>   if (copy_from_user(_buf, req->data.buf,sizeof(buf))
>   return -EFAULT
>   gdm_update_fsm(_buf);

Do you mean sizeof(fsm_s)? I realize this would have been far simpler than my
overkill solution.

> If you are touching the structs it might be wise to fix the other
> problems with them notably the use of int. sizes when used are unsigned -
> and signed sizes are asking for errors. In fact if you look at the
> existing uses of the size checks they look deeply suspicious the moment
> anything malicious passes in negative numbers.

I would love to do that, but it is a bit outside the scope of this patch, so I
would rather safe this for another patch.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: gdm72xx: add userspace data struct

2015-12-10 Thread Wim de With
This fixes the sparse warnings about dereferencing a userspace pointer.

Once I updated the sparse annotations, I noticed a bug in
gdm_wimax_ioctl() where we pass a user space pointer to gdm_update_fsm()
which dereferences it. I fixed this.

Signed-off-by: Wim de With <nauxu...@wimdewith.com>
---
 drivers/staging/gdm72xx/gdm_wimax.c | 17 +
 drivers/staging/gdm72xx/wm_ioctl.h  |  7 ++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index d9ddced..16eac61 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -368,7 +368,7 @@ static void kdelete(void **buf)
}
 }
 
-static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_get_data(struct udata_s *dst, struct data_s *src)
 {
int size;
 
@@ -384,7 +384,7 @@ static int gdm_wimax_ioctl_get_data(struct data_s *dst, 
struct data_s *src)
return 0;
 }
 
-static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct udata_s *src)
 {
if (!src->size) {
dst->size = 0;
@@ -460,6 +460,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
struct wm_req_s *req = (struct wm_req_s *)ifr;
struct nic *nic = netdev_priv(dev);
int ret;
+   void *fsm_buf;
 
if (cmd != SIOCWMIOCTL)
return -EOPNOTSUPP;
@@ -482,8 +483,16 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
/* NOTE: gdm_update_fsm should be called
 * before gdm_wimax_ioctl_set_data is called.
 */
-   gdm_update_fsm(dev,
-  req->data.buf);
+   fsm_buf = kmalloc(sizeof(fsm_s), GFP_KERNEL);
+   if (!fsm_buf)
+   return -ENOMEM;
+   if (copy_from_user(fsm_buf, req->data.buf,
+  sizeof(fsm_s))) {
+   kfree(fsm_buf);
+   return -EFAULT;
+   }
+   gdm_update_fsm(dev, fsm_buf);
+   kfree(fsm_buf);
}
ret = gdm_wimax_ioctl_set_data(
>sdk_data[req->data_id], >data);
diff --git a/drivers/staging/gdm72xx/wm_ioctl.h 
b/drivers/staging/gdm72xx/wm_ioctl.h
index ed8f649..631cb1d 100644
--- a/drivers/staging/gdm72xx/wm_ioctl.h
+++ b/drivers/staging/gdm72xx/wm_ioctl.h
@@ -78,13 +78,18 @@ struct data_s {
void*buf;
 };
 
+struct udata_s {
+   int size;
+   void __user *buf;
+};
+
 struct wm_req_s {
union {
char ifrn_name[IFNAMSIZ];
} ifr_ifrn;
unsigned short  cmd;
unsigned short  data_id;
-   struct data_s   data;
+   struct udata_s  data;
 
 /* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */
 };
-- 
2.6.3

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


[PATCH] staging: lustre: add __user attributes to llite/file.c

2015-12-08 Thread Wim de With
/lustre/lustre/llite/file.c:2389:35: warning: incorrect type in 
argument 1 (different address spaces)
drivers/staging/lustre/lustre/llite/file.c:2389:35:expected void [noderef] 
*to
drivers/staging/lustre/lustre/llite/file.c:2389:35:got char *
drivers/staging/lustre/lustre/llite/file.c:2483:36: warning: incorrect type in 
argument 1 (different address spaces)
drivers/staging/lustre/lustre/llite/file.c:2483:36:expected void const 
[noderef] *
drivers/staging/lustre/lustre/llite/file.c:2483:36:got void *

It simply casts pointers to __user pointers in most cases, and changes a
few pointers to __user pointers.

Signed-off-by: Wim de With <nauxu...@wimdewith.com>
---
 drivers/staging/lustre/lustre/llite/file.c | 43 --
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 02f2759..27fc7af 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1307,7 +1307,7 @@ static int ll_lov_recreate_obj(struct inode *inode, 
unsigned long arg)
if (!capable(CFS_CAP_SYS_ADMIN))
return -EPERM;
 
-   if (copy_from_user(, (struct ll_recreate_obj *)arg,
+   if (copy_from_user(, (struct ll_recreate_obj __user *)arg,
   sizeof(ucreat)))
return -EFAULT;
 
@@ -1325,7 +1325,7 @@ static int ll_lov_recreate_fid(struct inode *inode, 
unsigned long arg)
if (!capable(CFS_CAP_SYS_ADMIN))
return -EPERM;
 
-   if (copy_from_user(, (struct lu_fid *)arg, sizeof(fid)))
+   if (copy_from_user(, (struct lu_fid __user *)arg, sizeof(fid)))
return -EFAULT;
 
fid_to_ostid(, );
@@ -1472,7 +1472,7 @@ static int ll_lov_setea(struct inode *inode, struct file 
*file,
if (lump == NULL)
return -ENOMEM;
 
-   if (copy_from_user(lump, (struct lov_user_md *)arg, lum_size)) {
+   if (copy_from_user(lump, (struct lov_user_md __user *)arg, lum_size)) {
kvfree(lump);
return -EFAULT;
}
@@ -1490,8 +1490,10 @@ static int ll_lov_setstripe(struct inode *inode, struct 
file *file,
 {
struct lov_user_md_v3lumv3;
struct lov_user_md_v1   *lumv1 = (struct lov_user_md_v1 *)
-   struct lov_user_md_v1   *lumv1p = (struct lov_user_md_v1 *)arg;
-   struct lov_user_md_v3   *lumv3p = (struct lov_user_md_v3 *)arg;
+   struct lov_user_md_v1 __user *lumv1p =
+   (struct lov_user_md_v1 __user *)arg;
+   struct lov_user_md_v3 __user *lumv3p =
+   (struct lov_user_md_v3 __user *)arg;
int  lum_size, rc;
int  flags = FMODE_WRITE;
 
@@ -1826,7 +1828,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned 
long arg)
ret_bytes += (fiemap_s->fm_mapped_extents *
 sizeof(struct ll_fiemap_extent));
 
-   if (copy_to_user((void *)arg, fiemap_s, ret_bytes))
+   if (copy_to_user((void __user *)arg, fiemap_s, ret_bytes))
rc = -EFAULT;
 
 error:
@@ -2211,14 +2213,14 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
switch (cmd) {
case LL_IOC_GETFLAGS:
/* Get the current value of the file flags */
-   return put_user(fd->fd_flags, (int *)arg);
+   return put_user(fd->fd_flags, (int __user *)arg);
case LL_IOC_SETFLAGS:
case LL_IOC_CLRFLAGS:
/* Set or clear specific file flags */
/* XXX This probably needs checks to ensure the flags are
 * not abused, and to handle any flag side effects.
 */
-   if (get_user(flags, (int *) arg))
+   if (get_user(flags, (int __user *)arg))
return -EFAULT;
 
if (cmd == LL_IOC_SETFLAGS) {
@@ -2242,8 +2244,8 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
struct file *file2;
struct lustre_swap_layouts lsl;
 
-   if (copy_from_user(, (char *)arg,
-  sizeof(struct lustre_swap_layouts)))
+   if (copy_from_user(, (char __user *)arg,
+  sizeof(struct lustre_swap_layouts)))
return -EFAULT;
 
if ((file->f_flags & O_ACCMODE) == 0) /* O_RDONLY */
@@ -2272,7 +2274,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
return ll_iocontrol(inode, file, cmd, arg);
case FSFILT_IOC_GETVERSION_OLD:
case FSFILT_IOC_GETVERSION:
-   return put_user(inode->i_generation, (int *)arg);
+   return put_user(inode->i_generation, (int __user *)arg);
case LL_IOC_GROUP_LOCK:
return 

[PATCH] staging: dgnc: fix line length over 80 chars in dgnc_sysfs.c

2015-05-20 Thread Wim de With
This patch fixes most of the lines over 80 characters long in
dgnc_sysfs.c. I couldn't find a way to break line 202-207 in a sensible
way. If there is a way, let me know.

Signed-off-by: Wim de With nauxu...@wimdewith.com
---
 drivers/staging/dgnc/dgnc_sysfs.c | 110 +-
 1 file changed, 74 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 65551d1..44db870 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -53,7 +53,8 @@ static ssize_t dgnc_driver_pollrate_show(struct device_driver 
*ddp, char *buf)
return snprintf(buf, PAGE_SIZE, %dms\n, dgnc_poll_tick);
 }
 
-static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, const 
char *buf, size_t count)
+static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp,
+ const char *buf, size_t count)
 {
int ret;
 
@@ -62,7 +63,8 @@ static ssize_t dgnc_driver_pollrate_store(struct 
device_driver *ddp, const char
return -EINVAL;
return count;
 }
-static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, 
dgnc_driver_pollrate_store);
+static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
+  dgnc_driver_pollrate_store);
 
 
 void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
@@ -104,7 +106,8 @@ void dgnc_remove_driver_sysfiles(struct pci_driver 
*dgnc_driver)
 
 
 
-static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr, 
char *buf)
+static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
+char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -112,7 +115,8 @@ static ssize_t dgnc_vpd_show(struct device *p, struct 
device_attribute *attr, ch
 
DGNC_VERIFY_BOARD(p, bd);
 
-   count += sprintf(buf + count, \n  0  1  2  3  4  5  6  7  8  9  A  
B  C  D  E  F);
+   count += sprintf(buf + count,
+   \n  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F);
for (i = 0; i  0x40 * 2; i++) {
if (!(i % 16))
count += sprintf(buf + count, \n%04X , i * 2);
@@ -124,7 +128,8 @@ static ssize_t dgnc_vpd_show(struct device *p, struct 
device_attribute *attr, ch
 }
 static DEVICE_ATTR(vpd, S_IRUSR, dgnc_vpd_show, NULL);
 
-static ssize_t dgnc_serial_number_show(struct device *p, struct 
device_attribute *attr, char *buf)
+static ssize_t dgnc_serial_number_show(struct device *p,
+  struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -141,7 +146,8 @@ static ssize_t dgnc_serial_number_show(struct device *p, 
struct device_attribute
 static DEVICE_ATTR(serial_number, S_IRUSR, dgnc_serial_number_show, NULL);
 
 
-static ssize_t dgnc_ports_state_show(struct device *p, struct device_attribute 
*attr, char *buf)
+static ssize_t dgnc_ports_state_show(struct device *p,
+struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -159,7 +165,8 @@ static ssize_t dgnc_ports_state_show(struct device *p, 
struct device_attribute *
 static DEVICE_ATTR(ports_state, S_IRUSR, dgnc_ports_state_show, NULL);
 
 
-static ssize_t dgnc_ports_baud_show(struct device *p, struct device_attribute 
*attr, char *buf)
+static ssize_t dgnc_ports_baud_show(struct device *p,
+   struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -169,14 +176,17 @@ static ssize_t dgnc_ports_baud_show(struct device *p, 
struct device_attribute *a
 
for (i = 0; i  bd-nasync; i++) {
count +=  snprintf(buf + count, PAGE_SIZE - count,
-   %d %d\n, bd-channels[i]-ch_portnum, 
bd-channels[i]-ch_old_baud);
+   %d %d\n, bd-channels[i]-ch_portnum,
+   bd-channels[i]-ch_old_baud);
}
return count;
 }
 static DEVICE_ATTR(ports_baud, S_IRUSR, dgnc_ports_baud_show, NULL);
 
 
-static ssize_t dgnc_ports_msignals_show(struct device *p, struct 
device_attribute *attr, char *buf)
+static ssize_t dgnc_ports_msignals_show(struct device *p,
+   struct device_attribute *attr,
+   char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -187,7 +197,8 @@ static ssize_t dgnc_ports_msignals_show(struct device *p, 
struct device_attribut
for (i = 0; i  bd-nasync; i++) {
if (bd-channels[i]-ch_open_count) {
count += snprintf(buf + count, PAGE_SIZE - count,
-   %d %s %s %s %s %s %s\n, 
bd-channels[i]-ch_portnum,
+   %d %s %s %s %s %s %s\n

Re: [PATCH] Staging: unisys: fix function declaration format in visorchipset.c

2015-05-18 Thread Wim de With
On 18-5-2015 12:45, Jes Sorensen wrote:
 Wim de With nauxu...@wimdewith.com writes:
 This is a patch that fixes the function declarations in
 visorbus/visorchipset.c by removing newlines after the function return
 type
 
 This patch doesn't fix things, it makes things worse!
 
 If you want to post patches to this, do it properly and check the output
 first.
 
 NACK
 
 Jes

But how is line breaking in function headers supposed to be done? The
coding style documentation specifically state the following:
Descendants are always substantially shorter than the parent and are
placed substantially to the right. The same applies to function headers
with a long argument list.

I really don't want to bother you with trivial patches, especially when
they are incorrect, but I am trying to learn something, so I hope you
will help me out.

Wim









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