Nicolas Del Piano | 25 Apr 06:06 2014
Picon

[PATCH] Staging: comedi: drivers: fixed a coding style issue.


_______________________________________________
devel mailing list
devel <at> linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Jimmy Li | 25 Apr 04:52 2014
Picon

[PATCH]staging:iio:ad2s1200 fix missing parenthesis in a for statment.

Signed-off-by: Jimmy Li <coder.liss <at> gmail.com>
---
 drivers/staging/iio/resolver/ad2s1200.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index e2b4820..017d2f8 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
 <at>  <at>  -107,7 +107,7  <at>  <at>  static int ad2s1200_probe(struct spi_device *spi)
 	int pn, ret = 0;
 	unsigned short *pins = spi->dev.platform_data;

-	for (pn = 0; pn < AD2S1200_PN; pn++)
+	for (pn = 0; pn < AD2S1200_PN; pn++) {
 		ret = devm_gpio_request_one(&spi->dev, pins[pn], GPIOF_DIR_OUT,
 					    DRV_NAME);
 		if (ret) {
 <at>  <at>  -115,6 +115,7  <at>  <at>  static int ad2s1200_probe(struct spi_device *spi)
 							pins[pn]);
 			return ret;
 		}
+	}
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
 	if (!indio_dev)
 		return -ENOMEM;
--

-- 
1.7.9.5
Dan Carpenter | 24 Apr 23:49 2014
Picon

[patch 2/2] staging: lustre: integer overflow in obd_ioctl_is_invalid()

The obd_ioctl_getdata() function caps "data->ioc_len" at
OBD_MAX_IOCTL_BUFFER and then calls this obd_ioctl_is_invalid() to check
that the other values inside data are valid.

There are several lengths inside data but when they are added together
they must not be larger than "data->ioc_len".  The checks against
"(data->ioc_inllen1 > (1<<30))" are supposed to ensure that the addition
does not have an integer overflow.  But "(1<<30) * 4" actually can
overflow 32 bits so the checks are insufficient.

I have changed it to "> OBD_MAX_IOCTL_BUFFER" instead.

Signed-off-by: Dan Carpenter <dan.carpenter <at> oracle.com>

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 0368ca6..04f549e 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
 <at>  <at>  -192,23 +192,23  <at>  <at>  static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)

 static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
 {
-	if (data->ioc_len > (1<<30)) {
+	if (data->ioc_len > OBD_MAX_IOCTL_BUFFER) {
 		CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
 		return 1;
 	}
-	if (data->ioc_inllen1 > (1<<30)) {
+	if (data->ioc_inllen1 > OBD_MAX_IOCTL_BUFFER) {
 		CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
(Continue reading)

Dan Carpenter | 24 Apr 23:49 2014
Picon

[patch 1/2] staging: lustre: improve length checks in ioctls

We copy "hdr->ioc_len" from the user twice but we only verify that it's
within the limit on the first copy.  Otherwise we could read unmapped
memory and Oops.

Signed-off-by: Dan Carpenter <dan.carpenter <at> oracle.com>
---
Not tested.

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index e4e94cc..dec1037 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
 <at>  <at>  -122,6 +122,8  <at>  <at>  int obd_ioctl_getdata(char **buf, int *len, void *arg)
 		OBD_FREE_LARGE(*buf, hdr.ioc_len);
 		return err;
 	}
+	if (hdr.ioc_len != data->ioc_len)
+		return -EINVAL;

 	if (obd_ioctl_is_invalid(data)) {
 		CERROR("ioctl not correctly formatted\n");
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index e6eae06..9a3b07b 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
 <at>  <at>  -44,6 +44,7  <at>  <at>  int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
 {
 	struct libcfs_ioctl_hdr   *hdr;
 	struct libcfs_ioctl_data  *data;
+	int orig_len;
(Continue reading)

Ian Abbott | 24 Apr 22:09 2014
Picon

Re: [PATCH 19/22] staging: comedi: adv_pci1710: tidy up start_pacer()

On 24/04/14 19:14, Hartley Sweeten wrote:
> On Thursday, April 24, 2014 4:27 AM, Ian Abbott wrote:
>> On 2014-04-24 00:07, H Hartley Sweeten wrote:
>>> For aesthetics, rename this function so it has namespace associated
>>> with the driver.
>>>
>>> Change the parameters to the function. The 'mode' is really a flag to
>>> load the counters and the divisors can be found in the private data.
>>>
>>> To clarify the code and remove the magic numbers, use the 8253.h
>>> helpers to set the timer mode and load the counters.
>>>
>>> Signed-off-by: H Hartley Sweeten <hsweeten <at> visionengravers.com>
>>> Cc: Ian Abbott <abbotti <at> mev.co.uk>
>>> Cc: Greg Kroah-Hartman <gregkh <at> linuxfoundation.org>
>>> ---
>>>    drivers/staging/comedi/drivers/adv_pci1710.c | 42 +++++++++++++---------------
>>>    1 file changed, 20 insertions(+), 22 deletions(-)
>
> [snip]
>
>> Okay, but probably needs changing to use different members of the device
>> private data to make sure it it loads the "live command" divisors rather
>> than the "command test" divisors.
>
> Same comments as with PATCH 13/22. I think the core already handles
> keeping the "live" command the "test" command separate.

To clarify, I mean it probably needs changing to use different members 
as a consequence of fixing patch 17, which mixes yup the "live" and 
(Continue reading)

Ian Abbott | 24 Apr 22:00 2014
Picon

Re: [PATCH 21/22] staging: comedi: adv_pci1710: handle events and clear interrupt in common code

On 24/04/14 19:11, Hartley Sweeten wrote:
> On Thursday, April 24, 2014 4:50 AM, Ian Abbott wrote:
>> On 2014-04-24 00:07, H Hartley Sweeten wrote:
>>> The helper functions that handle reading the analog input samples for
>>> the interrupt function both call cfc_handle_events() and clear the
>>> interrupt request at various times.
>>>
>>> Move this to the main interrupt handler to make sure the events are
>>> posted and the interrupt request is cleared.
>>>
>>> Signed-off-by: H Hartley Sweeten <hsweeten <at> visionengravers.com>
>>> Cc: Ian Abbott <abbotti <at> mev.co.uk>
>>> Cc: Greg Kroah-Hartman <gregkh <at> linuxfoundation.org>
>>> ---
>>>    drivers/staging/comedi/drivers/adv_pci1710.c | 22 ++++------------------
>>>    1 file changed, 4 insertions(+), 18 deletions(-)
>>>
>
> [snip]
>
>>>  <at>  <at>  -945,6 +927,10  <at>  <at>  static irqreturn_t interrupt_service_pci1710(int irq, void *d)
>>>    	else
>>>    		pci1710_handle_fifo(dev, s);
>>>
>>> +	cfc_handle_events(dev, s);
>>> +
>>> +	outb(0, dev->iobase + PCI171x_CLRINT);
>>> +
>>>    	return IRQ_HANDLED;
>>>    }
(Continue reading)

Ian Abbott | 24 Apr 21:48 2014
Picon

Re: [PATCH 13/22] staging: comedi: adv_pci1710: don't check the chanlist twice

On 24/04/14 18:35, Hartley Sweeten wrote:
> On Thursday, April 24, 2014 4:06 AM, Ian Abbott wrote:
>> On 2014-04-24 00:07, H Hartley Sweeten wrote:
>>> The chanlist is checked in Step 5 of the (*do_cmdtest) there is no
>>> reason to check it again in the (*do_cmd). The only reasonm its done
>>> is to get the actual 'seglen', the non-repeating length of the chanlist.
>>>
>>> Save the 'seglen' found by pci171x_ai_check_chanlist() in the private
>>> data and use that in the (*do_cmd).
>>
>> Since do_cmdtest can be done while a command is running, one needs to be
>> careful to make sure that any private data modified by do_cmdtest is not
>> used by the running command, and only used by do_cmd when setting up the
>> next command.
>
> Ian,
>
> I think the "live" command used for a running command and the "test"
> command are already handled properly by the core.
>
> The COMEDI_CMDTEST ioctl is handled by do_cmdtest_ioctl(). This function
> copies the users command to a local variable that is then passed to the
> subdevice (*do_cmdtest) function, this is the "test" command. Any
> modifications that function does to the command are then passed back
> to the user. Since the comedi_cmd is a local variable it does not affect the
> running command that is stored in the async->cmd.
>
> The COMEDI_CMD ioctl is handled by do_cmd_ioctl(). This function also
> copies the users command to a local variable. It then checks the subdevice
> lock and busy members to make sure that the command can actually be
(Continue reading)

Ken Cox | 24 Apr 20:57 2014
Picon

[Patch 0/4] staging: unisys: Fix module loading on non s-Par platform

This series fixes the problem reported by Fengguang Wu <fengguang.wu <at> intel.com>
where the unisys modules will cause a panic if loaded on a non s-Par 
platform.

Each module now has a check in the init function to ensure that it is being
loaded on an s-Par platform and returns an error if it isn't.

In addition, a MODULE_DEVICE_TABLE entry is now created by virthba so that 
the modules will now autoload when the kernel boots.
Mark Hounschell | 24 Apr 16:41 2014
Picon

[PATCH] staging: dgap: fix sparse warnings Using plain integer as NULL pointer

This patch fixes sparse warnings:
warning: Using plain integer as NULL pointer

Signed-off-by: Mark Hounschell <markh <at> compro.net>
Cc: Greg Kroah-Hartman <gregkh <at> linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 81919e4..ee5bdeb 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
 <at>  <at>  -318,22 +318,22  <at>  <at>  struct firmware_info {
  * Firmware - BIOS, FEP, and CONC filenames
  */
 static struct firmware_info fw_info[] = {
-	{ "dgap/dgap.conf", "dgap/sxbios.bin",  "dgap/sxfep.bin",  0, 0 },
-	{ "dgap/dgap.conf", "dgap/cxpbios.bin", "dgap/cxpfep.bin", 0, 1 },
-	{ "dgap/dgap.conf", "dgap/cxpbios.bin", "dgap/cxpfep.bin", 0, 2 },
-	{ "dgap/dgap.conf", "dgap/pcibios.bin", "dgap/pcifep.bin", 0, 3 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 4 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 5 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 6 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 7 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 8 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 9 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 10 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 11 },
-	{ "dgap/dgap.conf", "dgap/xrbios.bin",  "dgap/xrfep.bin",  0, 12 },
(Continue reading)

Mark Hounschell | 24 Apr 16:33 2014
Picon

[PATCH] staging: dgap: fix sparse warning about dgap_poll_lock

This patch fixes a sparse warning:

warning: symbol 'dgap_poll_lock' was not declared. Should it be static?

Signed-off-by: Mark Hounschell <markh <at> compro.net>
Cc: Greg Kroah-Hartman <gregkh <at> linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index eb9cd74..81919e4 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
 <at>  <at>  -226,7 +226,7  <at>  <at>  static uint dgap_count = 500;
 /*
  * Poller stuff
  */
-DEFINE_SPINLOCK(dgap_poll_lock);	/* Poll scheduling lock */
+static DEFINE_SPINLOCK(dgap_poll_lock);	/* Poll scheduling lock */
 static ulong dgap_poll_time;		/* Time of next poll */
 static uint dgap_poll_stop;		/* Used to tell poller to stop */
 static struct timer_list dgap_poll_timer;
--

-- 
1.8.4.5
Mark Hounschell | 24 Apr 16:31 2014
Picon

[PATCH] [v3] fix sparse warning about dgap_poll_lock

This patch fixes a sparse warning:

warning: symbol 'dgap_poll_lock' was not declared. Should it be static?

Signed-off-by: Mark Hounschell <markh <at> compro.net>
Cc: Greg Kroah-Hartman <gregkh <at> linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index eb9cd74..81919e4 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
 <at>  <at>  -226,7 +226,7  <at>  <at>  static uint dgap_count = 500;
 /*
  * Poller stuff
  */
-DEFINE_SPINLOCK(dgap_poll_lock);	/* Poll scheduling lock */
+static DEFINE_SPINLOCK(dgap_poll_lock);	/* Poll scheduling lock */
 static ulong dgap_poll_time;		/* Time of next poll */
 static uint dgap_poll_stop;		/* Used to tell poller to stop */
 static struct timer_list dgap_poll_timer;
--

-- 
1.8.4.5

Gmane