Re:size_t-to-int vulnerability in Linux’s filesystem layer
by usefulcat on Tuesday July 20, 2021 @04:12PM
(#27898658)
GCC's -Wconversion has some issues. For example, good luck getting gcc to /not/ emit a warning for this code, in C or C++. I have yet to find the appropriate cast to avoid a warning. Clang does not warn for this.
I mean, I guess I can see the rationale.. it's just annoying to have to resort to using pragmas to turn off -Wconversion whenever I need to assign to a bitfield.
[ Parent
| on HN ]
Re:size_t-to-int vulnerability in Linux’s filesystem layer
by Denvercoder9 on Tuesday July 20, 2021 @04:36PM
(#27898949)
Does it still warn if you do `s->value = value & 0x0F`? That seems like a reasonable alternative to pragmas if it works.