diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/crypto.c | 16 | ||||
-rw-r--r-- | fs/ecryptfs/keystore.c | 3 | ||||
-rw-r--r-- | fs/nfsd/nfs4recover.c | 8 |
3 files changed, 17 insertions, 10 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 1ae90ef2c74..0a9882edf56 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -283,7 +283,7 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, pg = virt_to_page(addr); offset = offset_in_page(addr); if (sg) { - sg[i].page = pg; + sg_set_page(&sg[i], pg); sg[i].offset = offset; } remainder_of_page = PAGE_CACHE_SIZE - offset; @@ -713,10 +713,13 @@ ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat, { struct scatterlist src_sg, dst_sg; - src_sg.page = src_page; + sg_init_table(&src_sg, 1); + sg_init_table(&dst_sg, 1); + + sg_set_page(&src_sg, src_page); src_sg.offset = src_offset; src_sg.length = size; - dst_sg.page = dst_page; + sg_set_page(&dst_sg, dst_page); dst_sg.offset = dst_offset; dst_sg.length = size; return encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); @@ -742,10 +745,13 @@ ecryptfs_decrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat, { struct scatterlist src_sg, dst_sg; - src_sg.page = src_page; + sg_init_table(&src_sg, 1); + sg_init_table(&dst_sg, 1); + + sg_set_page(&src_sg, src_page); src_sg.offset = src_offset; src_sg.length = size; - dst_sg.page = dst_page; + sg_set_page(&dst_sg, dst_page); dst_sg.offset = dst_offset; dst_sg.length = size; return decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 89d9710dd63..263fed88c0c 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -1040,6 +1040,9 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, }; int rc = 0; + sg_init_table(&dst_sg, 1); + sg_init_table(&src_sg, 1); + if (unlikely(ecryptfs_verbosity > 0)) { ecryptfs_printk( KERN_DEBUG, "Session key encryption key (size [%d]):\n", diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index ebd03cc0747..6f03918018a 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -88,7 +88,7 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) { struct xdr_netobj cksum; struct hash_desc desc; - struct scatterlist sg[1]; + struct scatterlist sg; __be32 status = nfserr_resource; dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", @@ -102,11 +102,9 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) if (cksum.data == NULL) goto out; - sg[0].page = virt_to_page(clname->data); - sg[0].offset = offset_in_page(clname->data); - sg[0].length = clname->len; + sg_init_one(&sg, clname->data, clname->len); - if (crypto_hash_digest(&desc, sg, sg->length, cksum.data)) + if (crypto_hash_digest(&desc, &sg, sg.length, cksum.data)) goto out; md5_to_hex(dname, cksum.data); |