Re: [PATCH] Simplify shift operations on constants

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

 



On Sat, 2019-03-02T18:38+0100, Luc Van Oostenryck wrote:
> On Sat, Mar 02, 2019 at 08:26:36AM -0800, Linus Torvalds wrote:
>> On Sat, Mar 2, 2019 at 4:16 AM Thomas Weißschuh <thomas@xxxxxxxx> wrote:
>>>
>>> The result of a shift operation on a constants by a constant value is
>>> also constant.
>>
>> Yes it is, and sparse used to get this right.
>>
>> This was actually broken by commit 0b73dee0 ("big-shift: move the
>> check into check_shift_count()") which clearly _intended_ to do no
>> harm, but which was completely broken.
>>
>> [..]
>
> Yes, indeed. Mea culpa.
>
>> I think a better patch for expand.c would be something like the
>> attached, that fixes the logic mistake, and moves the "conservative"
>> check too into check_shift_count().
>
> I just sent a smaller fix (but with duplicated test for the size)
> but yes, separating the check from the warn is much better.

I'm actually not sure how to proceed.
Should I integrate Linus' fix, your description and my test and resend them, or
do you want to do it?

>> NOTE! This is entirely untested, and I think all credit for the patch
>> should go to Thomas who write a test-case and a changelog.
>
> and found the problem. Sure.

Thanks!

Thomas



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux