Commit a07c48ad authored by Dan Carpenter's avatar Dan Carpenter Committed by Tyler Hicks

eCryptfs: remove unneeded checks in virt_to_scatterlist()

This is always called with a valid "sg" pointer.  My static checker
complains because the call to sg_init_table() dereferences "sg" before
we reach the checks.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
parent 111d61a2
...@@ -301,17 +301,14 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, ...@@ -301,17 +301,14 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
while (size > 0 && i < sg_size) { while (size > 0 && i < sg_size) {
pg = virt_to_page(addr); pg = virt_to_page(addr);
offset = offset_in_page(addr); offset = offset_in_page(addr);
if (sg) sg_set_page(&sg[i], pg, 0, offset);
sg_set_page(&sg[i], pg, 0, offset);
remainder_of_page = PAGE_CACHE_SIZE - offset; remainder_of_page = PAGE_CACHE_SIZE - offset;
if (size >= remainder_of_page) { if (size >= remainder_of_page) {
if (sg) sg[i].length = remainder_of_page;
sg[i].length = remainder_of_page;
addr += remainder_of_page; addr += remainder_of_page;
size -= remainder_of_page; size -= remainder_of_page;
} else { } else {
if (sg) sg[i].length = size;
sg[i].length = size;
addr += size; addr += size;
size = 0; size = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment