grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v14 1/3] safemath: Add ALIGN_UP_OVF() that checks for {over,u


From: Gao Xiang
Subject: Re: [PATCH v14 1/3] safemath: Add ALIGN_UP_OVF() that checks for {over,under}flow
Date: Sun, 19 May 2024 11:26:30 +0800
User-agent: Mozilla Thunderbird

Hi Daniel,

There is too many comments on this minor stuff, would you mind
giving some hints of your perference so I could have a chance
to finish this stuff?

https://lore.kernel.org/grub-devel/CAEaD8JNwa8W=3LvaVeDG0hByz10+XHEDwCsV8TQe5md_13s2jg@mail.gmail.com/
8f2512f9-e851-467c-bbb8-450bf0219696@gmail.com/">https://lore.kernel.org/grub-devel/8f2512f9-e851-467c-bbb8-450bf0219696@gmail.com/

Thanks in advance.

Thanks,
Gao Xiang

On 2024/5/19 11:21, Gao Xiang wrote:


On 2024/5/18 17:20, Vladimir 'phcoder' Serbinenko wrote:


Le ven. 17 mai 2024, 21:26, Gao Xiang <hsiangkao@linux.alibaba.com 
<mailto:hsiangkao@linux.alibaba.com>> a écrit :

    Hi Vladimir,

    On 2024/5/18 00:38, Vladimir 'phcoder' Serbinenko wrote:
     > I think that given that align is a non zero const we can trust it.

      From the EROFS specific cases, they are always non-zero values,
    So I agree with you on this..

    Yet Daniel said ".. Be careful with underflows too." in
    Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl">https://lore.kernel.org/r/Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl 
<Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl">https://lore.kernel.org/r/Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl>
    although I'm not quite sure but I guess like this.

    Also as a generic helper, I think `align` could be zero if it's
    a variable..


It's rare for align to be a variable and then additional checks are needed that 
align is a power of 2. And power of 2 is never zero. This check is better done 
on the caller side. You just need a comment specify that it's caller 
responsibility to check it.

I'd like to know Daniel's comment about this first, there are already
too many comments out of nits.  I'm fine with updating such nits but
I would like to confirm _which comment_ I should follow for
upstreaming.

Thanks,
Gao Xiang



    Anyway, either way works for EROFS.   I just try my best to do
    what I could do for this first series for upstreaming and we
    could move forward to the next step..

    Thanks,
    Gao Xiang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]