Re: [PATCH RFC] input/elants_i2c: Detect enum overflow

2021-02-10 Thread Michał Mirosław
On Wed, Feb 10, 2021 at 10:25:28AM -0600, Josh Poimboeuf wrote: > If an enum value were to get added without updating this switch > statement, the unreachable() annotation would trigger undefined > behavior, causing execution to fall through the end of the function, > into the next one. > > Make

[PATCH RFC] input/elants_i2c: Detect enum overflow

2021-02-10 Thread Josh Poimboeuf
If an enum value were to get added without updating this switch statement, the unreachable() annotation would trigger undefined behavior, causing execution to fall through the end of the function, into the next one. Make the error handling more robust for an unexpected enum value, by doing BUG()