public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sesterhenn <snakebyte@gmx.de>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: linux-kernel@vger.kernel.org, Henk.Vergonet@gmail.com
Subject: Re: [Patch] Off by one in drivers/usb/input/yealink.c
Date: Wed, 28 Jun 2006 01:26:01 +0200	[thread overview]
Message-ID: <1151450761.16746.1.camel@alice> (raw)
In-Reply-To: <20060627161826.db62fd00.rdunlap@xenotime.net>

> :) 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



  reply	other threads:[~2006-06-27 23:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-27 22:41 [Patch] Off by one in drivers/usb/input/yealink.c Eric Sesterhenn
2006-06-27 22:51 ` Randy.Dunlap
2006-06-27 23:04   ` Eric Sesterhenn / Snakebyte
2006-06-27 23:18     ` Randy.Dunlap
2006-06-27 23:26       ` Eric Sesterhenn [this message]
2006-07-05 13:02   ` Henk Vergonet
     [not found]     ` <d120d5000607050655o44cb66c3s7616493c7507d4d8@mail.gmail.com>
2006-07-06  0:49       ` Eric Sesterhenn / Snakebyte
2006-07-06  2:25         ` Dmitry Torokhov
2006-07-06 14:41           ` Eric Sesterhenn / Snakebyte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1151450761.16746.1.camel@alice \
    --to=snakebyte@gmx.de \
    --cc=Henk.Vergonet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox