[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZlsvHV6y4DEdC8ja@kbusch-mbp.dhcp.thefacebook.com>
Date: Sat, 1 Jun 2024 08:24:29 -0600
From: Keith Busch <kbusch@...nel.org>
To: Andreas Hindborg <nmi@...aspace.dk>
Cc: Jens Axboe <axboe@...nel.dk>, Christoph Hellwig <hch@....de>,
Damien Le Moal <dlemoal@...nel.org>,
Bart Van Assche <bvanassche@....org>,
Hannes Reinecke <hare@...e.de>, Ming Lei <ming.lei@...hat.com>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
Andreas Hindborg <a.hindborg@...sung.com>,
Greg KH <gregkh@...uxfoundation.org>,
Matthew Wilcox <willy@...radead.org>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Alice Ryhl <aliceryhl@...gle.com>,
Chaitanya Kulkarni <chaitanyak@...dia.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Yexuan Yang <1182282462@...t.edu.cn>,
Sergio González Collado <sergio.collado@...il.com>,
Joel Granados <j.granados@...sung.com>,
"Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>,
Daniel Gomez <da.gomez@...sung.com>,
Niklas Cassel <Niklas.Cassel@....com>,
Philipp Stanner <pstanner@...hat.com>,
Conor Dooley <conor@...nel.org>,
Johannes Thumshirn <Johannes.Thumshirn@....com>,
Matias Bjørling <m@...rling.me>,
open list <linux-kernel@...r.kernel.org>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
"lsf-pc@...ts.linux-foundation.org" <lsf-pc@...ts.linux-foundation.org>,
"gost.dev@...sung.com" <gost.dev@...sung.com>
Subject: Re: [PATCH v4 2/3] rust: block: add rnull, Rust null_blk
implementation
On Sat, Jun 01, 2024 at 03:40:04PM +0200, Andreas Hindborg wrote:
> +impl kernel::Module for NullBlkModule {
> + fn init(_module: &'static ThisModule) -> Result<Self> {
> + pr_info!("Rust null_blk loaded\n");
> + let tagset = Arc::pin_init(TagSet::try_new(1, 256, 1), flags::GFP_KERNEL)?;
> +
> + let disk = {
> + let block_size: u16 = 4096;
> + if block_size % 512 != 0 || !(512..=4096).contains(&block_size) {
> + return Err(kernel::error::code::EINVAL);
> + }
You've set block_size to the literal 4096, then validate its value
immediately after? Am I missing some way this could ever be invalid?
Powered by blists - more mailing lists