linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] pata_legacy: bogus clock in opti82c46x_set_piomode()
@ 2013-03-11 11:41 Dan Carpenter
  2013-04-03 23:56 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-03-11 11:41 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, kernel-janitors

"sysclk" is used as an index into a 4 element array.  My static
checker complains because it can be out of bounds.  From the
context, it looks like there is a right bit shift missing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I don't have the hardware to test this.

diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 4fe9d21..be81642 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -542,7 +542,7 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	u8 sysclk;
 
 	/* Get the clock */
-	sysclk = opti_syscfg(0xAC) & 0xC0;	/* BIOS set */
+	sysclk = (opti_syscfg(0xAC) & 0xC0) >> 6;	/* BIOS set */
 
 	/* Enter configuration mode */
 	ioread16(ap->ioaddr.error_addr);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-03 23:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 11:41 [patch] pata_legacy: bogus clock in opti82c46x_set_piomode() Dan Carpenter
2013-04-03 23:56 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).