[PATCH] Make host_no an unsigned int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 15, 2008 at 03:31:47PM -0500, Brian King wrote:
> Matthew Wilcox wrote:
> > Or we could make the host_no a u64 and avoid the problem ever happening
> > in our lifetimes.  I'm amazed that anyone's had the time to do 4 billion
> > add/removes, to be honest.  Assuming it takes 1 second per add/remove
> > cycle, and there's not even time to scan a bus in that time, that's
> > still 136 years.
> 
> That was my thought as well, until I checked struct scsi_host and saw
> that hostno is actually defined as a short there, which makes the problem
> slightly easier to hit. So, we could just increase both of them to u64's
> and be done with it...

Oh, right.

It's an unsigned short, between two ints, so there's no additional space
consumed by making it an unsigned int.  An experienced hacker also notes
the 'SCSI_IOCTL_GET_IDLUN' comment, researches it, and finds out you
only get the bottom 8 bits of host_no anyway.

----

[PATCH] Make host_no an unsigned int

Daniel Debonzi reports that he has managed to wrap host_no.  Increasing
the number of host numbers available to 32-bit from 16-bit allows the
problem to be evaded for another hundred years.

Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 1834fdf..062161d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -547,7 +547,7 @@ struct Scsi_Host {
 	unsigned int host_failed;	   /* commands that failed. */
 	unsigned int host_eh_scheduled;    /* EH scheduled without command */
     
-	unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
+	unsigned int host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
 	int resetting; /* if set, it means that last_reset is a valid value */
 	unsigned long last_reset;
 

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux