Skip to content

Commit 8d1058f

Browse files
mauelshaMike Snitzer
authored andcommitted
dm: fix use of sizeof() macro
Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 6cc435f commit 8d1058f

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

drivers/md/dm-bufio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
18151815
(block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
18161816
unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
18171817

1818-
snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size);
1818+
snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u", block_size);
18191819
c->slab_cache = kmem_cache_create(slab_name, block_size, align,
18201820
SLAB_RECLAIM_ACCOUNT, NULL);
18211821
if (!c->slab_cache) {
@@ -1824,9 +1824,9 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
18241824
}
18251825
}
18261826
if (aux_size)
1827-
snprintf(slab_name, sizeof slab_name, "dm_bufio_buffer-%u", aux_size);
1827+
snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u", aux_size);
18281828
else
1829-
snprintf(slab_name, sizeof slab_name, "dm_bufio_buffer");
1829+
snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer");
18301830
c->slab_buffer = kmem_cache_create(slab_name, sizeof(struct dm_buffer) + aux_size,
18311831
0, SLAB_RECLAIM_ACCOUNT, NULL);
18321832
if (!c->slab_buffer) {

drivers/md/dm-integrity.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned int section, __u8 re
826826
}
827827

828828
section_le = cpu_to_le64(section);
829-
r = crypto_shash_update(desc, (__u8 *)&section_le, sizeof section_le);
829+
r = crypto_shash_update(desc, (__u8 *)&section_le, sizeof(section_le));
830830
if (unlikely(r < 0)) {
831831
dm_integrity_io_error(ic, "crypto_shash_update", r);
832832
goto err;
@@ -836,7 +836,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned int section, __u8 re
836836
for (j = 0; j < ic->journal_section_entries; j++) {
837837
struct journal_entry *je = access_journal_entry(ic, section, j);
838838

839-
r = crypto_shash_update(desc, (__u8 *)&je->u.sector, sizeof je->u.sector);
839+
r = crypto_shash_update(desc, (__u8 *)&je->u.sector, sizeof(je->u.sector));
840840
if (unlikely(r < 0)) {
841841
dm_integrity_io_error(ic, "crypto_shash_update", r);
842842
goto err;
@@ -1687,7 +1687,7 @@ static void integrity_sector_checksum(struct dm_integrity_c *ic, sector_t sector
16871687
}
16881688
}
16891689

1690-
r = crypto_shash_update(req, (const __u8 *)&sector_le, sizeof sector_le);
1690+
r = crypto_shash_update(req, (const __u8 *)&sector_le, sizeof(sector_le));
16911691
if (unlikely(r < 0)) {
16921692
dm_integrity_io_error(ic, "crypto_shash_update", r);
16931693
goto failed;
@@ -2967,8 +2967,8 @@ static void replay_journal(struct dm_integrity_c *ic)
29672967
goto clear_journal;
29682968

29692969
journal_empty = true;
2970-
memset(used_commit_ids, 0, sizeof used_commit_ids);
2971-
memset(max_commit_id_sections, 0, sizeof max_commit_id_sections);
2970+
memset(used_commit_ids, 0, sizeof(used_commit_ids));
2971+
memset(max_commit_id_sections, 0, sizeof(max_commit_id_sections));
29722972
for (i = 0; i < ic->journal_sections; i++) {
29732973
for (j = 0; j < ic->journal_section_sectors; j++) {
29742974
int k;
@@ -3685,7 +3685,7 @@ static void free_alg(struct alg_spec *a)
36853685
{
36863686
kfree_sensitive(a->alg_string);
36873687
kfree_sensitive(a->key);
3688-
memset(a, 0, sizeof *a);
3688+
memset(a, 0, sizeof(*a));
36893689
}
36903690

36913691
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)
38523852
clear_page(va);
38533853
sg_set_buf(&sg[i], va, PAGE_SIZE);
38543854
}
3855-
sg_set_buf(&sg[i], &ic->commit_ids, sizeof ic->commit_ids);
3855+
sg_set_buf(&sg[i], &ic->commit_ids, sizeof(ic->commit_ids));
38563856

38573857
skcipher_request_set_crypt(req, sg, sg,
3858-
PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv);
3858+
PAGE_SIZE * ic->journal_pages + sizeof(ic->commit_ids), crypt_iv);
38593859
init_completion(&comp.comp);
38603860
comp.in_flight = (atomic_t)ATOMIC_INIT(1);
38613861
if (do_crypt(true, req, &comp))

drivers/md/dm-kcopyd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
826826
job->pages = NULL;
827827
job->op = REQ_OP_READ;
828828
} else {
829-
memset(&job->source, 0, sizeof job->source);
829+
memset(&job->source, 0, sizeof(job->source));
830830
job->source.count = job->dests[0].count;
831831
job->pages = &zero_page_list;
832832

drivers/md/dm-writecache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ static void writecache_poison_lists(struct dm_writecache *wc)
772772
/*
773773
* Catch incorrect access to these values while the device is suspended.
774774
*/
775-
memset(&wc->tree, -1, sizeof wc->tree);
775+
memset(&wc->tree, -1, sizeof(wc->tree));
776776
wc->lru.next = LIST_POISON1;
777777
wc->lru.prev = LIST_POISON2;
778778
wc->freelist.next = LIST_POISON1;
@@ -1182,7 +1182,7 @@ static int process_clear_stats_mesg(unsigned int argc, char **argv, struct dm_wr
11821182
return -EINVAL;
11831183

11841184
wc_lock(wc);
1185-
memset(&wc->stats, 0, sizeof wc->stats);
1185+
memset(&wc->stats, 0, sizeof(wc->stats));
11861186
wc_unlock(wc);
11871187

11881188
return 0;
@@ -2174,7 +2174,7 @@ static int init_memory(struct dm_writecache *wc)
21742174
writecache_flush_all_metadata(wc);
21752175
writecache_commit_flushed(wc, false);
21762176
pmem_assign(sb(wc)->magic, cpu_to_le32(MEMORY_SUPERBLOCK_MAGIC));
2177-
writecache_flush_region(wc, &sb(wc)->magic, sizeof sb(wc)->magic);
2177+
writecache_flush_region(wc, &sb(wc)->magic, sizeof(sb(wc)->magic));
21782178
writecache_commit_flushed(wc, false);
21792179

21802180
return 0;

0 commit comments

Comments
 (0)