From: Dan Carpenter <dan.carpenter@oracle.com>
To: hare@suse.de
Cc: dm-devel@redhat.com
Subject: [bug report] dm zoned: metadata version 2
Date: Wed, 13 May 2020 12:36:41 +0300 [thread overview]
Message-ID: <20200513093616.GA347693@mwanda> (raw)
Hello Hannes Reinecke,
The patch 70978208ec91: "dm zoned: metadata version 2" from May 11,
2020, leads to the following static checker warning:
drivers/md/dm-zoned-target.c:1047 dmz_iterate_devices()
warn: was expecting a 64 bit value instead of '~(zone_nr_sectors - 1)'
drivers/md/dm-zoned-target.c
1039 static int dmz_iterate_devices(struct dm_target *ti,
1040 iterate_devices_callout_fn fn, void *data)
1041 {
1042 struct dmz_target *dmz = ti->private;
1043 unsigned int zone_nr_sectors = dmz_zone_nr_sectors(dmz->metadata);
1044 sector_t capacity;
1045 int r;
1046
1047 capacity = dmz->dev[0].capacity & ~(zone_nr_sectors - 1);
sector_t is a u64 and zone_nr_sectors is a u32. It means that the high
32 bits are always cleared. Making zone_nr_sectors a sector_t, u64 or
even an int would fix this problem.
1048 r = fn(ti, dmz->ddev[0], 0, capacity, data);
1049 if (!r && dmz->ddev[1]) {
1050 capacity = dmz->dev[1].capacity & ~(zone_nr_sectors - 1);
1051 r = fn(ti, dmz->ddev[1], 0, capacity, data);
1052 }
1053 return r;
1054 }
regards,
dan carpenter
reply other threads:[~2020-05-13 9:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200513093616.GA347693@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.