From 3336564f68cb964478db684e5e70815fc179e97b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 30 Nov 2020 14:09:15 -0500 Subject: [PATCH] Fix: handle default switch case with -EINVAL in __lttng_counter_add Signed-off-by: Mathieu Desnoyers Change-Id: Ie7cb76725789a75cfd7cf2bdb3031a81983ad146 --- libcounter/counter-api.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libcounter/counter-api.h b/libcounter/counter-api.h index d18fa16e..540055ae 100644 --- a/libcounter/counter-api.h +++ b/libcounter/counter-api.h @@ -101,6 +101,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= UINT8_MAX || n < old)) overflow = true; @@ -140,6 +142,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= UINT16_MAX || n < old)) overflow = true; @@ -179,6 +183,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config, } while (old != res); break; } + default: + return -EINVAL; } if (v > 0 && (v >= UINT32_MAX || n < old)) overflow = true; @@ -219,6 +225,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; -- 2.34.1