* [PATCH] remove unnecessary checks in pcmcia
@ 2003-09-29 17:04 davej
2003-09-29 17:19 ` Russell King
2003-09-29 17:22 ` Jeff Garzik
0 siblings, 2 replies; 4+ messages in thread
From: davej @ 2003-09-29 17:04 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
io->stop/start are 16 bits, so will never be >0xffff
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/i82092.c linux-2.5/drivers/pcmcia/i82092.c
--- bk-linus/drivers/pcmcia/i82092.c 2003-09-13 14:44:55.000000000 +0100
+++ linux-2.5/drivers/pcmcia/i82092.c 2003-09-13 16:20:24.000000000 +0100
@@ -675,7 +675,7 @@ static int i82092aa_set_io_map(struct pc
leave("i82092aa_set_io_map with invalid map");
return -EINVAL;
}
- if ((io->start > 0xffff) || (io->stop > 0xffff) || (io->stop < io->start)){
+ if (io->stop < io->start) {
leave("i82092aa_set_io_map with invalid io");
return -EINVAL;
}
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/i82365.c linux-2.5/drivers/pcmcia/i82365.c
--- bk-linus/drivers/pcmcia/i82365.c 2003-09-11 21:18:34.000000000 +0100
+++ linux-2.5/drivers/pcmcia/i82365.c 2003-09-12 15:37:05.000000000 +0100
@@ -1143,8 +1143,8 @@ static int i365_set_io_map(u_short sock,
"%#4.4x-%#4.4x)\n", sock, io->map, io->flags,
io->speed, io->start, io->stop);
map = io->map;
- if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
- (io->stop < io->start)) return -EINVAL;
+ if ((map > 1) || (io->stop < io->start))
+ return -EINVAL;
/* Turn off the window before changing anything */
if (i365_get(sock, I365_ADDRWIN) & I365_ENA_IO(map))
i365_bclr(sock, I365_ADDRWIN, I365_ENA_IO(map));
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/tcic.c linux-2.5/drivers/pcmcia/tcic.c
--- bk-linus/drivers/pcmcia/tcic.c 2003-09-11 21:18:34.000000000 +0100
+++ linux-2.5/drivers/pcmcia/tcic.c 2003-09-12 15:37:05.000000000 +0100
@@ -786,8 +786,8 @@ static int tcic_set_io_map(struct pcmcia
DEBUG(1, "tcic: SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
io->speed, io->start, io->stop);
- if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
- (io->stop < io->start)) return -EINVAL;
+ if ((io->map > 1) || (io->stop < io->start))
+ return -EINVAL;
tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
addr = TCIC_IWIN(psock, io->map);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] remove unnecessary checks in pcmcia
2003-09-29 17:04 [PATCH] remove unnecessary checks in pcmcia davej
@ 2003-09-29 17:19 ` Russell King
2003-09-29 17:20 ` Dave Jones
2003-09-29 17:22 ` Jeff Garzik
1 sibling, 1 reply; 4+ messages in thread
From: Russell King @ 2003-09-29 17:19 UTC (permalink / raw)
To: davej; +Cc: torvalds, linux-kernel
On Mon, Sep 29, 2003 at 06:04:34PM +0100, davej@redhat.com wrote:
> io->stop/start are 16 bits, so will never be >0xffff
Not necessarily. On x86 yes. On ARM, no.
--
Russell King (rmk@arm.linux.org.uk) http://www.arm.linux.org.uk/personal/
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] remove unnecessary checks in pcmcia
2003-09-29 17:19 ` Russell King
@ 2003-09-29 17:20 ` Dave Jones
0 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2003-09-29 17:20 UTC (permalink / raw)
To: torvalds, linux-kernel
On Mon, Sep 29, 2003 at 06:19:01PM +0100, Russell King wrote:
> On Mon, Sep 29, 2003 at 06:04:34PM +0100, davej@redhat.com wrote:
> > io->stop/start are 16 bits, so will never be >0xffff
>
> Not necessarily. On x86 yes. On ARM, no.
I recall discussing this with you when I first wrote that patch.
Mind explaining what I've missed ?
Dave
--
Dave Jones http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] remove unnecessary checks in pcmcia
2003-09-29 17:04 [PATCH] remove unnecessary checks in pcmcia davej
2003-09-29 17:19 ` Russell King
@ 2003-09-29 17:22 ` Jeff Garzik
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2003-09-29 17:22 UTC (permalink / raw)
To: davej; +Cc: torvalds, linux-kernel
On Mon, Sep 29, 2003 at 06:04:34PM +0100, davej@redhat.com wrote:
> io->stop/start are 16 bits, so will never be >0xffff
>
> diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/i82092.c linux-2.5/drivers/pcmcia/i82092.c
> --- bk-linus/drivers/pcmcia/i82092.c 2003-09-13 14:44:55.000000000 +0100
> +++ linux-2.5/drivers/pcmcia/i82092.c 2003-09-13 16:20:24.000000000 +0100
> @@ -675,7 +675,7 @@ static int i82092aa_set_io_map(struct pc
> leave("i82092aa_set_io_map with invalid map");
> return -EINVAL;
> }
> - if ((io->start > 0xffff) || (io->stop > 0xffff) || (io->stop < io->start)){
> + if (io->stop < io->start) {
> leave("i82092aa_set_io_map with invalid io");
> return -EINVAL;
> }
I would think the code should fail on ==0 and ==0xffff, no?
Also, does this need the "if map > 1" check the code below has?
> diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/i82365.c linux-2.5/drivers/pcmcia/i82365.c
> --- bk-linus/drivers/pcmcia/i82365.c 2003-09-11 21:18:34.000000000 +0100
> +++ linux-2.5/drivers/pcmcia/i82365.c 2003-09-12 15:37:05.000000000 +0100
> @@ -1143,8 +1143,8 @@ static int i365_set_io_map(u_short sock,
> "%#4.4x-%#4.4x)\n", sock, io->map, io->flags,
> io->speed, io->start, io->stop);
> map = io->map;
> - if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
> - (io->stop < io->start)) return -EINVAL;
> + if ((map > 1) || (io->stop < io->start))
> + return -EINVAL;
> /* Turn off the window before changing anything */
> if (i365_get(sock, I365_ADDRWIN) & I365_ENA_IO(map))
> i365_bclr(sock, I365_ADDRWIN, I365_ENA_IO(map));
likewise
> diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/tcic.c linux-2.5/drivers/pcmcia/tcic.c
> --- bk-linus/drivers/pcmcia/tcic.c 2003-09-11 21:18:34.000000000 +0100
> +++ linux-2.5/drivers/pcmcia/tcic.c 2003-09-12 15:37:05.000000000 +0100
> @@ -786,8 +786,8 @@ static int tcic_set_io_map(struct pcmcia
> DEBUG(1, "tcic: SetIOMap(%d, %d, %#2.2x, %d ns, "
> "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
> io->speed, io->start, io->stop);
> - if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
> - (io->stop < io->start)) return -EINVAL;
> + if ((io->map > 1) || (io->stop < io->start))
> + return -EINVAL;
> tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
> addr = TCIC_IWIN(psock, io->map);
likewise
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-09-29 17:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-29 17:04 [PATCH] remove unnecessary checks in pcmcia davej
2003-09-29 17:19 ` Russell King
2003-09-29 17:20 ` Dave Jones
2003-09-29 17:22 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox