lkml.org 
[lkml]   [2006]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [Patch] Off by one in drivers/usb/input/yealink.c
From
Date
> :) Yep.
>
> so for the floppy.c patch, I still prefer to see:
> + if (drive < 0 || drive >= N_DRIVE) {
>
> instead of
> + if (drive < 0 || drive > N_DRIVE-1) {
>
> Does that make sense?

looks better :)

---

another bug spotted by coverity (id #481).
In the case that drive == N_DRIVE we acess past the
drive_params array which is defined as
drive_params[N_DRIVE]. By using the UDP define
in the else case because UDP is &drive_params[drive]

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.17-git11/drivers/block/floppy.c.orig 2006-06-28 01:22:59.000000000 +0200
+++ linux-2.6.17-git11/drivers/block/floppy.c 2006-06-28 01:23:24.000000000 +0200
@@ -684,7 +684,7 @@ static void __reschedule_timeout(int dri
if (drive == current_reqD)
drive = current_drive;
del_timer(&fd_timeout);
- if (drive < 0 || drive > N_DRIVE) {
+ if (drive < 0 || drive >= N_DRIVE) {
fd_timeout.expires = jiffies + 20UL * HZ;
drive = 0;
} else

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-28 01:28    [W:0.058 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site