[patch] staging: comedi: comedi_bond: silence a shift wrapping warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We set this using:

	devs_closed |= (0x1 << bdev->minor)

Since 0x1 is an int then only the lower 32 bits are usable before we hit
a shift wrapping bug.  There are some static checkers which complain
about this.  I've silenced the warning by making devs_closed a 32 bit
number.

32 bits should be enough for anybody.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c
index 7e20bf0..8f6c942 100644
--- a/drivers/staging/comedi/drivers/comedi_bond.c
+++ b/drivers/staging/comedi/drivers/comedi_bond.c
@@ -335,7 +335,7 @@ static int bonding_attach(struct comedi_device *dev,
 static void bonding_detach(struct comedi_device *dev)
 {
 	struct comedi_bond_private *devpriv = dev->private;
-	unsigned long devs_closed = 0;
+	unsigned int devs_closed = 0;
 
 	if (devpriv) {
 		while (devpriv->ndevs-- && devpriv->devs) {
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux