Commit 5d88e24
orangefs: Fix the size of a memory allocation in orangefs_bufmap_alloc()
commit 40a7487 upstream.
'buffer_index_array' really looks like a bitmap. So it should be allocated
as such.
When kzalloc is called, a number of bytes is expected, but a number of
longs is passed instead.
In get(), if not enough memory is allocated, un-allocated memory may be
read or written.
So use bitmap_zalloc() to safely allocate the correct memory size and
avoid un-expected behavior.
While at it, change the corresponding kfree() into bitmap_free() to keep
the semantic.
Fixes: ea2c9c9 ("orangefs: bufmap rewrite")
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Mike Marshall <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 0084fef commit 5d88e24
1 file changed
+3
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
| |||
250 | 249 | | |
251 | 250 | | |
252 | 251 | | |
253 | | - | |
| 252 | + | |
254 | 253 | | |
255 | 254 | | |
256 | 255 | | |
| |||
0 commit comments