There's a bug in blkdev_issue_secure_erase. The statement
"unsigned int len = min_t(sector_t, nr_sects, max_sectors);"
sets the variable "len" to the length in sectors, but the statement
"bio->bi_iter.bi_size = len" treats it as if it were in bytes.
The statements "sector += len << SECTOR_SHIFT" an
On Wed, 14 Sep 2022 16:55:51 -0400 (EDT), Mikulas Patocka wrote:
> There's a bug in blkdev_issue_secure_erase. The statement
> "unsigned int len = min_t(sector_t, nr_sects, max_sectors);"
> sets the variable "len" to the length in sectors, but the statement
> "bio->bi_iter.bi_size = len" treats it
On Wed, Sep 14, 2022 at 04:55:51PM -0400, Mikulas Patocka wrote:
> + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */
> + if (max_sectors > UINT_MAX >> SECTOR_SHIFT)
> + max_sectors = UINT_MAX >> SECTOR_SHIFT;
This should use max / max_t:
max_sectors = max(m