Commit 1d3c09b
Bytes: Fix read() and write()
read() and write() must not ignore the `count` parameter: The mappings
passed into the `try_access()` closure are only valid for up to `count`
bytes, not more.
(Note: We cannot really have a test case for this, as right now, memory
fragmentation will only happen exactly at memory region boundaries. In
this case, `region.write()`/`region.read()` will only access the region
up until its end, even if the passed slice is longer, and so silently
ignore the length mismatch. This change is necessary for when page
boundaries result in different mappings within a single region, i.e. the
region does not end at the fragmentation point, and calling
`region.write()`/`region.read()` would write/read across the boundary.
Because we don’t have IOMMU support yet, this can’t be tested.)
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>1 parent 5b6bf8d commit 1d3c09b
2 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
562 | | - | |
| 561 | + | |
| 562 | + | |
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
| |||
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
571 | | - | |
572 | | - | |
| 571 | + | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
0 commit comments