Re: [xfsprogs] Do we need so many data types for user input?

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

 



On Tue, Apr 4, 2017 at 10:17 PM, Eric Sandeen <sandeen@xxxxxxxxxxx> wrote:
> On 4/4/17 2:48 PM, Luis R. Rodriguez wrote:
>>
>> And then agsize is capped artificially later via validate_ag_geometry():
>>
>>         if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
>>               ...
>>       if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
>>               ...
>>       if (agsize > dblocks) {
>>               ...
>>       if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
>>               ...
>>
>> Its not clear if this is capped at UINT_MAX or if we need ULLONG_MAX here.
>
> .maxval = XFS_AG_MAX_BYTES,
>
> #define XFS_AG_MAX_BYTES        ((XFS_AG_BYTES(31)))    /* 1 TB */
> #define XFS_AG_BYTES(bblog)     ((long long)BBSIZE << (bblog))
>
> so the maximum is (long long)(512) << 31
>
> so, no - agsize won't fit in a 32 bit var, if that's the question...
>

Yeah. I think that we can make it uint64 everywhere unless it is
causing an issue in a specific case with a bit shift or something, and
just limit the input value where appropriate explicitly.


And...
> And at the end of the day, we are converting all numbers into unsigned

I take back this part, we are going through long long, not unsigned long long.
Everything else is still valid.

Jan

-- 
Jan Tulak
jtulak@xxxxxxxxxx / jan@xxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux