Commit b689dfb
scsi: sd: Fix capacity calculation with 32-bit sector_t
commit 7c856152cb92f8eee2df29ef325a1b1f43161aff upstream.
We previously made sure that the reported disk capacity was less than
0xffffffff blocks when the kernel was not compiled with large sector_t
support (CONFIG_LBDAF). However, this check assumed that the capacity
was reported in units of 512 bytes.
Add a sanity check function to ensure that we only enable disks if the
entire reported capacity can be expressed in terms of sector_t.
Reported-by: Steve Magnani <steve.magnani@digidescorp.com>
Cc: Bart Van Assche <Bart.VanAssche@sandisk.com>
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 4489619 commit b689dfb
1 file changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2051 | 2051 | | |
2052 | 2052 | | |
2053 | 2053 | | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2054 | 2070 | | |
2055 | 2071 | | |
2056 | 2072 | | |
| |||
2116 | 2132 | | |
2117 | 2133 | | |
2118 | 2134 | | |
2119 | | - | |
| 2135 | + | |
2120 | 2136 | | |
2121 | 2137 | | |
2122 | 2138 | | |
| |||
2202 | 2218 | | |
2203 | 2219 | | |
2204 | 2220 | | |
2205 | | - | |
| 2221 | + | |
2206 | 2222 | | |
2207 | 2223 | | |
2208 | 2224 | | |
| |||
0 commit comments