Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Nitesh Shetty <nj.shetty@samsung.com>,
	Chaitanya Kulkarni <kch@nvidia.com>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk,
	johannes.thumshirn@wdc.com, ming.lei@redhat.com,
	bvanassche@acm.org, shinichiro.kawasaki@wdc.com,
	vincent.fu@samsung.com
Subject: Re: [PATCH V2 1/1] null_blk: add moddule parameter check
Date: Tue, 11 Apr 2023 14:29:23 +0900	[thread overview]
Message-ID: <92bce410-8a0f-5580-94d9-8952ebbab2d7@kernel.org> (raw)
In-Reply-To: <20230410174708.pv6xm4pwaszyabte@green5>

On 4/11/23 02:47, Nitesh Shetty wrote:
>> static int g_gb = 250;
>> -module_param_named(gb, g_gb, int, 0444);
>> +NULL_PARAM(gb, 1, INT_MAX);
> 
> This value gets converted to mb, for dev->size calculation in
> null_alloc_dev. I think either there should be a type conversion or
> this module parameter max value can be reduced to smaller value.

Yeah, good catch. it is multiplied by 1024, and assigned to dev->size which is
an unsigned long. So that could overflow on 32-bits arch. So this needs some fixing.

I would still allow a very large value as possible though, to allow testing for
overflows.

> 
>> +device_param_cb(gb, &null_gb_param_ops, &g_gb, 0444);
>> MODULE_PARM_DESC(gb, "Size in GB");

Chaitanya,

Another thing: did you check if setting all these arguments through configfs
also gets the same min/max value treatment ? Ideally, we want both configuration
interfaces (module args and configfs) to be equivalent.

(Note: please use dlemoal@kernel.org. wdc.com addresses do not work right now)

  reply	other threads:[~2023-04-11  5:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  5:13 [PATCH V2 0/1 null_blk: add modparam checks Chaitanya Kulkarni
2023-04-10  5:13 ` [PATCH V2 1/1] null_blk: add moddule parameter check Chaitanya Kulkarni
2023-04-10  5:58   ` Damien Le Moal
2023-04-10 17:47   ` Nitesh Shetty
2023-04-11  5:29     ` Damien Le Moal [this message]
2023-04-11  6:40       ` Chaitanya Kulkarni
2023-04-11  7:02         ` Damien Le Moal

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=92bce410-8a0f-5580-94d9-8952ebbab2d7@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=johannes.thumshirn@wdc.com \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nj.shetty@samsung.com \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=vincent.fu@samsung.com \
    /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