Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73e0d48b authored by Michael Buesch's avatar Michael Buesch Committed by Linus Torvalds
Browse files

parport_pc: Fix subscription bugs



This patch fixes array subscription bugs in the parport_pc driver.

drivers/parport/parport_pc.c: In function ‘parport_irq_probe’:
drivers/parport/parport_pc.c:1589: warning: array subscript is above array bounds
drivers/parport/parport_pc.c: In function ‘parport_pc_probe_port’:
drivers/parport/parport_pc.c:1579: warning: array subscript is above array bounds

The patch also fixes a few other array bugs, which the compiler was
unable to find. Coding style violations are also fixed.

Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0b4068a1
Loading
Loading
Loading
Loading
+18 −16
Original line number Original line Diff line number Diff line
@@ -1252,11 +1252,11 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
	   are related, however DMA can be 1 or 3, assume DMA_A=DMA1,
	   are related, however DMA can be 1 or 3, assume DMA_A=DMA1,
	   DMA_C=DMA3 (this is true e.g. for TYAN 1564D Tomcat IV) */
	   DMA_C=DMA3 (this is true e.g. for TYAN 1564D Tomcat IV) */
	if (cr23 * 4 >= 0x100) { /* if active */
	if (cr23 * 4 >= 0x100) { /* if active */
		while((superios[i].io!= 0) && (i<NR_SUPERIOS))
		while ((i < NR_SUPERIOS) && (superios[i].io != 0))
			i++;
			i++;
		if(i==NR_SUPERIOS)
		if (i == NR_SUPERIOS) {
			printk(KERN_INFO "Super-IO: too many chips!\n");
			printk(KERN_INFO "Super-IO: too many chips!\n");
		else {
		} else {
			int d;
			int d;
			switch (cr23*4) {
			switch (cr23*4) {
				case 0x3bc:
				case 0x3bc:
@@ -1333,11 +1333,11 @@ static void __devinit show_parconfig_winbond(int io, int key)
	}
	}


	if (cr30 & 0x01) { /* the settings can be interrogated later ... */
	if (cr30 & 0x01) { /* the settings can be interrogated later ... */
		while((superios[i].io!= 0) && (i<NR_SUPERIOS))
		while ((i < NR_SUPERIOS) && (superios[i].io != 0))
			i++;
			i++;
		if(i==NR_SUPERIOS) 
		if (i == NR_SUPERIOS) {
			printk(KERN_INFO "Super-IO: too many chips!\n");
			printk(KERN_INFO "Super-IO: too many chips!\n");
		else {
		} else {
			superios[i].io = (cr60<<8)|cr61;
			superios[i].io = (cr60<<8)|cr61;
			superios[i].irq = cr70&0x0f;
			superios[i].irq = cr70&0x0f;
			superios[i].dma = (((cr74 & 0x07) > 3) ?
			superios[i].dma = (((cr74 & 0x07) > 3) ?
@@ -1576,7 +1576,8 @@ static void __devinit detect_and_report_it87(void)
static int get_superio_dma (struct parport *p)
static int get_superio_dma (struct parport *p)
{
{
	int i = 0;
	int i = 0;
	while( (superios[i].io != p->base) && (i<NR_SUPERIOS))

	while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
		i++;
		i++;
	if (i != NR_SUPERIOS)
	if (i != NR_SUPERIOS)
		return superios[i].dma;
		return superios[i].dma;
@@ -1586,7 +1587,8 @@ static int get_superio_dma (struct parport *p)
static int get_superio_irq (struct parport *p)
static int get_superio_irq (struct parport *p)
{
{
	int i = 0;
	int i = 0;
        while( (superios[i].io != p->base) && (i<NR_SUPERIOS))

        while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
                i++;
                i++;
        if (i != NR_SUPERIOS)
        if (i != NR_SUPERIOS)
                return superios[i].irq;
                return superios[i].irq;