lkml.org 
[lkml]   [2022]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] module: Fix selfAssignment cppcheck warning
Date


Le 12/06/2022 à 12:46, Alexey Dobriyan a écrit :
>> @@ -33,7 +33,8 @@
>> #ifdef CONFIG_STRICT_MODULE_RWX
>> # define strict_align(X) PAGE_ALIGN(X)
>> #else
>> -# define strict_align(X) (X)
>> +/* OR with zero to avoid cppcheck selfAssignment warning */
>> +# define strict_align(X) ((X) | 0)
>> #endif
>
> Can these myopic tools be taught to see around and notice second
> definition which does mutate variable so there is no self-assignment?

I guess not.

However, usually we use static inlines to avoid that. I'll send v2, will
be cleaner.
\
 
 \ /
  Last update: 2022-06-12 17:22    [W:0.057 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site