Re: [PATCH 2/5] ieot: default to not writing IEOT section
- From
Ben Peart <peartben@gmail.com>
- Date
- Nov 26, 2018, 21:47 UTC
- Message-ID
- <7e06ec44-a3a0-fa38-75a7-7b875ae0679e@gmail.com>
- In-Reply-To
- <CAGZ79kbaPKaCFGGXnbNchvk=1Q4Q5Hgt2hXOhcGo6pVwquhaEg@mail.gmail.com>
On 11/26/2018 2:59 PM, Stefan Beller wrote:
Show 14 quoted lines
>>> +static int record_ieot(void)
>>> +{
>>> + int val;
>>> +
>>
>> Initialize stack val to zero to ensure proper default.
>
> I don't think that is needed here, as we only use `val` when
> we first write to it via git_config_get_bool.
>
> Did you spot this via code review and thought of
> defensive programming or is there a tool that
> has a false positive here?
> Code review and defensive programming. I had to review the code in git_config_get_bool() to see if it always initialized the val even if it didn't find the requested config variable (esp since we don't pass in a default value for this function like we do others).
Show 5 quoted lines
>>
>>> + if (!git_config_get_bool("index.recordoffsettable", &val))
>>> + return val;
>>> + return 0;
>>> +}