lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Nov 2013 15:06:59 -0500
From:	Dave Jones <davej@...hat.com>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	hsweeten@...ionengravers.com
Subject: Re: staging: comedi: drivers: use comedi_dio_update_state() for
 complex cases

On Thu, Nov 07, 2013 at 06:27:54AM +0000, Linux Kernel wrote:
 > Gitweb:     http://git.kernel.org/linus/;a=commit;h=b3ff824a81e8978deb56f6d163479c1a0a606037
 > Commit:     b3ff824a81e8978deb56f6d163479c1a0a606037
 > Parent:     97f4289ad08cffe55de06d4ac4f89ac540450aee
 > Author:     H Hartley Sweeten <hsweeten@...ionengravers.com>
 > AuthorDate: Fri Aug 30 11:06:17 2013 -0700
 > Committer:  Greg Kroah-Hartman <gregkh@...uxfoundation.org>
 > CommitDate: Tue Sep 17 07:47:40 2013 -0700
 > 
 >     staging: comedi: drivers: use comedi_dio_update_state() for complex cases
 >     
 >     Use comedi_dio_update_state() to handle the boilerplate code to update
 >     the subdevice s->state for more complex cases where the hardware is only
 >     updated based on the 'mask' of the channels that are modified.
 >     
 >     Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.com>
 >     Reviewed-by: Ian Abbott <abbotti@....co.uk>
 >     Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
 
This bit looks suspect :-
 
 >  	if (mask) {
 > -		s->state &= ~mask;
 > -		s->state |= (bits & mask);
 > -
 >  		if (mask & 0x00ff)
 >  			outb(s->state & 0xff, dev->iobase + reg);
 > -		if ((mask & 0xff00) && (s->n_chan > 8))
 > +		if ((mask & 0xff00) & (s->n_chan > 8))
 >  			outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
 > -		if ((mask & 0xff0000) && (s->n_chan > 16))
 > +		if ((mask & 0xff0000) & (s->n_chan > 16))
 >  			outb((s->state >> 16) & 0xff, dev->iobase + reg + 2);
 > -		if ((mask & 0xff000000) && (s->n_chan > 24))
 > +		if ((mask & 0xff000000) & (s->n_chan > 24))
 >  			outb((s->state >> 24) & 0xff, dev->iobase + reg + 3);
 >  	}


should those be shifts ? Like so ?


diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c
index d041b714db29..29a54e5d73d6 100644
--- a/drivers/staging/comedi/drivers/pcl730.c
+++ b/drivers/staging/comedi/drivers/pcl730.c
@@ -173,11 +173,11 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
 	if (mask) {
 		if (mask & 0x00ff)
 			outb(s->state & 0xff, dev->iobase + reg);
-		if ((mask & 0xff00) & (s->n_chan > 8))
+		if ((mask & 0xff00) & (s->n_chan >> 8))
 			outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
-		if ((mask & 0xff0000) & (s->n_chan > 16))
+		if ((mask & 0xff0000) & (s->n_chan >> 16))
 			outb((s->state >> 16) & 0xff, dev->iobase + reg + 2);
-		if ((mask & 0xff000000) & (s->n_chan > 24))
+		if ((mask & 0xff000000) & (s->n_chan >> 24))
 			outb((s->state >> 24) & 0xff, dev->iobase + reg + 3);
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ