From: Mathieu Desnoyers Date: Mon, 30 Nov 2020 19:09:31 +0000 (-0500) Subject: Fix: handle default switch case with -EINVAL in __lttng_counter_add X-Git-Tag: v2.13.0-rc1~72 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=cf30b6d45037a1326c2b3712f4b50b723f84d2a8;p=lttng-modules.git Fix: handle default switch case with -EINVAL in __lttng_counter_add Signed-off-by: Mathieu Desnoyers --- diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h index 02d709a1..12520445 100644 --- a/include/counter/counter-api.h +++ b/include/counter/counter-api.h @@ -80,6 +80,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= U8_MAX || n < old)) overflow = true; @@ -119,6 +121,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= U16_MAX || n < old)) overflow = true; @@ -158,6 +162,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= U32_MAX || n < old)) overflow = true; @@ -198,6 +204,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && n < old) overflow = true;