Re: [PATCH 06/23] refs: use `size_t` indexes when iterating over ref transaction updates

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

 



On 05/17/2017 06:59 PM, Stefan Beller wrote:
> On Wed, May 17, 2017 at 5:05 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
> 
> Now this would want to have some selling words for it?
> I do not see an advantage of this patch as-is.
> 
> I mean technically we don't need a sign, so we use that extra bit
> to be able to process transactions up to twice the size. But I doubt
> that is the real reason. I'll read on, maybe a later patch will explain
> why we do this here.

The reason to use `size_t` is not signedness but rather that it might be
larger than `int` (e.g., 64 vs 32 bits), so you could theoretically get
an integer overflow otherwise. It's unlikely here, because it would be
hard to initiate an update of more than (2³¹-1) references in a single
update, but it's good hygiene anyway.

I'll mention that in the commit message.

Michael




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]