dm: fix use of sizeof() macro
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
parent
6cc435fa76
commit
8d1058fb2a
@ -1815,7 +1815,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
|
||||
(block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
|
||||
unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
|
||||
|
||||
snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size);
|
||||
snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u", block_size);
|
||||
c->slab_cache = kmem_cache_create(slab_name, block_size, align,
|
||||
SLAB_RECLAIM_ACCOUNT, NULL);
|
||||
if (!c->slab_cache) {
|
||||
@ -1824,9 +1824,9 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
|
||||
}
|
||||
}
|
||||
if (aux_size)
|
||||
snprintf(slab_name, sizeof slab_name, "dm_bufio_buffer-%u", aux_size);
|
||||
snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u", aux_size);
|
||||
else
|
||||
snprintf(slab_name, sizeof slab_name, "dm_bufio_buffer");
|
||||
snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer");
|
||||
c->slab_buffer = kmem_cache_create(slab_name, sizeof(struct dm_buffer) + aux_size,
|
||||
0, SLAB_RECLAIM_ACCOUNT, NULL);
|
||||
if (!c->slab_buffer) {
|
||||
|
@ -826,7 +826,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned int section, __u8 re
|
||||
}
|
||||
|
||||
section_le = cpu_to_le64(section);
|
||||
r = crypto_shash_update(desc, (__u8 *)§ion_le, sizeof section_le);
|
||||
r = crypto_shash_update(desc, (__u8 *)§ion_le, sizeof(section_le));
|
||||
if (unlikely(r < 0)) {
|
||||
dm_integrity_io_error(ic, "crypto_shash_update", r);
|
||||
goto err;
|
||||
@ -836,7 +836,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned int section, __u8 re
|
||||
for (j = 0; j < ic->journal_section_entries; j++) {
|
||||
struct journal_entry *je = access_journal_entry(ic, section, j);
|
||||
|
||||
r = crypto_shash_update(desc, (__u8 *)&je->u.sector, sizeof je->u.sector);
|
||||
r = crypto_shash_update(desc, (__u8 *)&je->u.sector, sizeof(je->u.sector));
|
||||
if (unlikely(r < 0)) {
|
||||
dm_integrity_io_error(ic, "crypto_shash_update", r);
|
||||
goto err;
|
||||
@ -1687,7 +1687,7 @@ static void integrity_sector_checksum(struct dm_integrity_c *ic, sector_t sector
|
||||
}
|
||||
}
|
||||
|
||||
r = crypto_shash_update(req, (const __u8 *)§or_le, sizeof sector_le);
|
||||
r = crypto_shash_update(req, (const __u8 *)§or_le, sizeof(sector_le));
|
||||
if (unlikely(r < 0)) {
|
||||
dm_integrity_io_error(ic, "crypto_shash_update", r);
|
||||
goto failed;
|
||||
@ -2967,8 +2967,8 @@ static void replay_journal(struct dm_integrity_c *ic)
|
||||
goto clear_journal;
|
||||
|
||||
journal_empty = true;
|
||||
memset(used_commit_ids, 0, sizeof used_commit_ids);
|
||||
memset(max_commit_id_sections, 0, sizeof max_commit_id_sections);
|
||||
memset(used_commit_ids, 0, sizeof(used_commit_ids));
|
||||
memset(max_commit_id_sections, 0, sizeof(max_commit_id_sections));
|
||||
for (i = 0; i < ic->journal_sections; i++) {
|
||||
for (j = 0; j < ic->journal_section_sectors; j++) {
|
||||
int k;
|
||||
@ -3685,7 +3685,7 @@ static void free_alg(struct alg_spec *a)
|
||||
{
|
||||
kfree_sensitive(a->alg_string);
|
||||
kfree_sensitive(a->key);
|
||||
memset(a, 0, sizeof *a);
|
||||
memset(a, 0, sizeof(*a));
|
||||
}
|
||||
|
||||
static int get_alg_and_key(const char *arg, struct alg_spec *a, char **error, char *error_inval)
|
||||
@ -3852,10 +3852,10 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
|
||||
clear_page(va);
|
||||
sg_set_buf(&sg[i], va, PAGE_SIZE);
|
||||
}
|
||||
sg_set_buf(&sg[i], &ic->commit_ids, sizeof ic->commit_ids);
|
||||
sg_set_buf(&sg[i], &ic->commit_ids, sizeof(ic->commit_ids));
|
||||
|
||||
skcipher_request_set_crypt(req, sg, sg,
|
||||
PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv);
|
||||
PAGE_SIZE * ic->journal_pages + sizeof(ic->commit_ids), crypt_iv);
|
||||
init_completion(&comp.comp);
|
||||
comp.in_flight = (atomic_t)ATOMIC_INIT(1);
|
||||
if (do_crypt(true, req, &comp))
|
||||
|
@ -826,7 +826,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
|
||||
job->pages = NULL;
|
||||
job->op = REQ_OP_READ;
|
||||
} else {
|
||||
memset(&job->source, 0, sizeof job->source);
|
||||
memset(&job->source, 0, sizeof(job->source));
|
||||
job->source.count = job->dests[0].count;
|
||||
job->pages = &zero_page_list;
|
||||
|
||||
|
@ -772,7 +772,7 @@ static void writecache_poison_lists(struct dm_writecache *wc)
|
||||
/*
|
||||
* Catch incorrect access to these values while the device is suspended.
|
||||
*/
|
||||
memset(&wc->tree, -1, sizeof wc->tree);
|
||||
memset(&wc->tree, -1, sizeof(wc->tree));
|
||||
wc->lru.next = LIST_POISON1;
|
||||
wc->lru.prev = LIST_POISON2;
|
||||
wc->freelist.next = LIST_POISON1;
|
||||
@ -1182,7 +1182,7 @@ static int process_clear_stats_mesg(unsigned int argc, char **argv, struct dm_wr
|
||||
return -EINVAL;
|
||||
|
||||
wc_lock(wc);
|
||||
memset(&wc->stats, 0, sizeof wc->stats);
|
||||
memset(&wc->stats, 0, sizeof(wc->stats));
|
||||
wc_unlock(wc);
|
||||
|
||||
return 0;
|
||||
@ -2174,7 +2174,7 @@ static int init_memory(struct dm_writecache *wc)
|
||||
writecache_flush_all_metadata(wc);
|
||||
writecache_commit_flushed(wc, false);
|
||||
pmem_assign(sb(wc)->magic, cpu_to_le32(MEMORY_SUPERBLOCK_MAGIC));
|
||||
writecache_flush_region(wc, &sb(wc)->magic, sizeof sb(wc)->magic);
|
||||
writecache_flush_region(wc, &sb(wc)->magic, sizeof(sb(wc)->magic));
|
||||
writecache_commit_flushed(wc, false);
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user