Re: [PATCH V2 1/1] null_blk: add moddule parameter check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx. wdc.com addresses do not work right now)



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux