linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "Matthew Wilcox" <willy@infradead.org>,
	"André Almeida" <andrealmeid@collabora.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"m@bjorling.me" <m@bjorling.me>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"krisman@collabora.com" <krisman@collabora.com>
Subject: Re: [PATCH 3/3] null_blk: validated the number of devices
Date: Fri, 13 Sep 2019 10:23:30 -0600	[thread overview]
Message-ID: <e029c399-e0cf-62e4-5ce3-a4287eb6cd94@kernel.dk> (raw)
In-Reply-To: <20190913151249.GN29434@bombadil.infradead.org>

On 9/13/19 9:12 AM, Matthew Wilcox wrote:
> On Fri, Sep 13, 2019 at 11:57:17AM -0300, André Almeida wrote:
>> On 9/12/19 7:20 PM, Chaitanya Kulkarni wrote:
>>> On 09/12/2019 03:09 PM, André Almeida wrote:
>>>> Hello Matthew,
>>>>
>>>> On 9/12/19 1:19 PM, Matthew Wilcox wrote:
>>>>> On Wed, Sep 11, 2019 at 11:46:36AM -0300, André Almeida wrote:
>>>>>>
>>>>>> -static int nr_devices = 1;
>>>>>> +static unsigned int nr_devices = 1;
>>>>>>    module_param(nr_devices, int, 0444);
>>>>>
>>>>> ^^^ you forgot to change the module_param to match
>>>>>
>>>>>> +	if (!nr_devices) {
>>>>>> +		pr_err("null_blk: invalid number of devices\n");
>>>>>> +		return -EINVAL;
>>>>>> +	}
>>>>>
>>>>> I don't think this is necessary.
>>>>>
>>>>
>>>> Could you explain why you don't think is necessary? As I see, the module
>>>> can't be used without any /dev/nullb* device, so why we should load it?
>>>>
>>>> Thanks,
>>>> 	André
>>>>
>>>
>>> I think Matthew is right here. I think module can be loaded with
>>> nr_devices=0.
>>>
>>> Did you get a chance to test nr_device=0 condition ?
>>>
>>
>> Yes. It says "module loaded" and lsmod shows that it is loaded indeed.
>> But you don't have any /dev/nullb*, so you can't do much with the module.
>>
>> With this patch, it refuses to load the module.
> 
> Why is that an improvement?  I agree it's an uninteresting thing to ask
> for, but I don't see a compelling need to fail the module load because
> of it.

It also breaks the case of loading it, then setting up a new device
through configfs.

-- 
Jens Axboe


  parent reply	other threads:[~2019-09-13 16:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 14:46 [PATCH 1/3] docs: block: null_blk: enhance document style André Almeida
2019-09-11 14:46 ` [PATCH 2/3] null_blk: fix module name at log message André Almeida
2019-09-12 15:47   ` Ezequiel Garcia
2019-09-12 20:47     ` Jens Axboe
2019-09-12 22:08       ` André Almeida
2019-09-11 14:46 ` [PATCH 3/3] null_blk: validated the number of devices André Almeida
2019-09-12 16:19   ` Matthew Wilcox
2019-09-12 22:07     ` André Almeida
2019-09-12 22:20       ` Chaitanya Kulkarni
2019-09-13 14:57         ` André Almeida
2019-09-13 15:12           ` Matthew Wilcox
2019-09-13 15:39             ` André Almeida
2019-09-13 16:23             ` Jens Axboe [this message]
2019-09-13 16:27               ` Chaitanya Kulkarni
2019-09-13 16:48                 ` Jens Axboe
2019-09-11 22:05 ` [PATCH 1/3] docs: block: null_blk: enhance document style Jens Axboe
2019-09-11 22:26   ` André Almeida

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=e029c399-e0cf-62e4-5ce3-a4287eb6cd94@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=andrealmeid@collabora.com \
    --cc=corbet@lwn.net \
    --cc=kernel@collabora.com \
    --cc=krisman@collabora.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=m@bjorling.me \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).