Re: [PATCH 2/2] block: share more code for bio addition helpers

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

 



On Wed, Nov 06, 2024 at 03:33:38PM +0530, Kundan Kumar wrote:
>> -int bio_add_page(struct bio *bio, struct page *page,
>> -		 unsigned int len, unsigned int offset)
>> +static int bio_do_add_page(struct bio *bio, struct page *page,
>> +		 unsigned int len, unsigned int offset, bool *same_page)
>
> As we are passing length within a folio, values will reach near UINT_MAX.
> It will be better to make len and offset as size_t, also to add a check like :
> if (len > UINT_MAX || offset > UINT_MAX)
> 		return 0;

Not sure what the point is.  IFF we get folio sizes overflowing an
unsigned int we'll have a massive problem as it will overflow the
bv_offset and bv_len fields.  So we'd need to address that first before
doing anything else.

>> {
>> -	bool same_page = false;
>
> nit: extra line got added

Yes, the previous code was missing the empty line after the variable
declaration, so this got fixed.





[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