Commit 7c88f7c
dm-crypt: fully initialize clone->bi_iter in crypt_alloc_buffer()
Both kcryptd_io_read() and kcryptd_crypt_write_convert() will invoke
crypt_alloc_buffer() to allocate a new bio. Both of these two callers
initialize bi_iter.bi_sector for the new bio separatedly after
crypt_alloc_buffer() returns. However, kcryptd_crypt_write_convert()
will copy the bi_iter of the new bio into ctx.iter_out or ctx.iter_in.
Although it doesn't incur any harm now, it is better to fully initialize
bi_iter before it is used.
Therefore, initialize bi_iter.bi_sector in crypt_alloc_buffer() instead.
Signed-off-by: Hou Tao <[email protected]>
Signed-off-by: Mikulas Patocka <[email protected]>1 parent 6fd2cb3 commit 7c88f7c
1 file changed
+3
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1719 | 1719 | | |
1720 | 1720 | | |
1721 | 1721 | | |
| 1722 | + | |
1722 | 1723 | | |
1723 | 1724 | | |
1724 | 1725 | | |
| |||
1909 | 1910 | | |
1910 | 1911 | | |
1911 | 1912 | | |
1912 | | - | |
1913 | 1913 | | |
1914 | 1914 | | |
1915 | 1915 | | |
| |||
1925 | 1925 | | |
1926 | 1926 | | |
1927 | 1927 | | |
| 1928 | + | |
| 1929 | + | |
1928 | 1930 | | |
1929 | 1931 | | |
1930 | 1932 | | |
1931 | 1933 | | |
1932 | 1934 | | |
1933 | | - | |
1934 | | - | |
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| |||
2039 | 2039 | | |
2040 | 2040 | | |
2041 | 2041 | | |
2042 | | - | |
2043 | | - | |
2044 | 2042 | | |
2045 | 2043 | | |
2046 | 2044 | | |
| |||
0 commit comments