Re: [linux-safety] [PATCH] coccinelle: misc: Check for hard-coded constants

"Shuah Khan" <[email protected]> Thu, 13 Aug 2020 08:39:23 -0600
Newsgroups tech.elisa.lists.linux-safety
Message-ID <[email protected]>
Hi Mohammed,

Thanks for your patch.

On 8/12/20 5:43 PM, Mohammed Billoo wrote:
> This semantic patch looks for variables that are initialized to
> constants, arrays that are both declared and indexed with constants.
> A false positive will occur  when a variable is initialized to 0, which
> must happen for auto variables. This will be resolved in a future patch.
> 
> The patch was tested against the following snippet:
> 
> int main()
> {
>      int iarr[54]; /* instance 1 */
>      int j = 0;    /* instance 2 */
>      int i = 1;    /* instance 3 */
>      iarr[0] = 3;  /* instance 4 */
>      return 0;
> }
> 
> and it correctly identified instances 1, 3, and 4. It incorrectly
> identified instance 2, which will be addressed in a future patch.

Please include the output from the tool that corresponds to your
changes to the script in the commit log on a kernel file.

Also I see 3 patches with incremental changes to the script. Please
make this a patch series which will make it easier for reviewers.

thanks,
-- Shuah