Skip to content

Commit

Permalink
staging: comedi: widen subdevice number argument in ioctl handlers
Browse files Browse the repository at this point in the history
For the `COMEDI_LOCK`, `COMEDI_UNLOCK`, `COMEDI_CANCEL`, and
`COMEDI_POLL` ioctls the third argument is a comedi subdevice number.
This is passed as an `unsigned long`, but when it is passed down to the
ioctl command-specific handler functions `do_lock_ioctl()`,
`do_unlock_ioctl()`, `do_cancel_ioctl()`, and `do_poll_ioctl()`, the
value has been narrowed to an `unsigned int`.  Pass through the argument
as an `unsigned long` to avoid truncating the value on 64-bit
architectures.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Oct 29, 2014
1 parent 7e74783 commit c1a6eac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
*/

static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
static int do_lock_ioctl(struct comedi_device *dev, unsigned long arg,
void *file)
{
int ret = 0;
Expand Down Expand Up @@ -1678,7 +1678,7 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
This function isn't protected by the semaphore, since
we already own the lock.
*/
static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
static int do_unlock_ioctl(struct comedi_device *dev, unsigned long arg,
void *file)
{
struct comedi_subdevice *s;
Expand Down Expand Up @@ -1713,7 +1713,7 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
nothing
*/
static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
static int do_cancel_ioctl(struct comedi_device *dev, unsigned long arg,
void *file)
{
struct comedi_subdevice *s;
Expand Down Expand Up @@ -1750,7 +1750,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
nothing
*/
static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg,
static int do_poll_ioctl(struct comedi_device *dev, unsigned long arg,
void *file)
{
struct comedi_subdevice *s;
Expand Down

0 comments on commit c1a6eac

Please sign in to comment.