Fix: handle default switch case with -EINVAL in __lttng_counter_add
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 30 Nov 2020 19:09:15 +0000 (14:09 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 30 Nov 2020 19:09:15 +0000 (14:09 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie7cb76725789a75cfd7cf2bdb3031a81983ad146

libcounter/counter-api.h

index d18fa16ec4dab65e51091cb5e498fa2572736ea1..540055aeec616616c14d2eefee410e53c5109792 100644 (file)
@@ -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;
This page took 0.025793 seconds and 4 git commands to generate.