* [bug report] dm zoned: metadata version 2
@ 2020-05-13 9:36 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-05-13 9:36 UTC (permalink / raw)
To: hare; +Cc: dm-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-13 9:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 9:36 [bug report] dm zoned: metadata version 2 Dan Carpenter
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.