lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Jan 2021 23:34:06 +0800
From:   Feng Li <lifeng1519@...il.com>
To:     Li Feng <fengli@...rtx.com>
Cc:     Jens Axboe <axboe@...nel.dk>,
        "open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] blk: avoid divide-by-zero with zero granularity

I'm sorry, ignore this one.

Li Feng <fengli@...rtx.com> 于2021年1月12日周二 下午11:30写道:
>
> If the physical_block_size and io_min is less than a sector, the
> 'granularity >> SECTOR_SHIFT' will be zero.
>
> Signed-off-by: Li Feng <fengli@...rtx.com>
> ---
>  include/linux/blkdev.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index f94ee3089e01..4d029e95adb4 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1485,6 +1485,10 @@ static inline int queue_alignment_offset(const struct request_queue *q)
>  static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
>  {
>         unsigned int granularity = max(lim->physical_block_size, lim->io_min);
> +       granularity = granularity >> SECTOR_SHIFT;
> +       if (!granularity)
> +               return 0;
> +
>         unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT)
>                 << SECTOR_SHIFT;
>
> --
> 2.29.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ