gpio-button-hotplug: fix data race
authorAndrey Erokhin <a.erokhin@inango-systems.com>
Wed, 6 Apr 2022 09:36:15 +0000 (12:36 +0300)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 10 Apr 2022 15:26:01 +0000 (16:26 +0100)
bh_event_add_var can be called by multiple threads concurrently,
so it shall not use a static char buffer

Signed-off-by: Andrey Erokhin <a.erokhin@inango-systems.com>
(cherry picked from commit 1e991e09b73c309321d21b9cb706bd5139d952d2)

package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c

index fcaf7f59de5c0e855ea8567867d8b520560a2ba7..2b39ec8f3be52e4c27986cf51844287829e032bd 100644 (file)
@@ -107,7 +107,7 @@ static struct bh_map button_map[] = {
 static __printf(3, 4)
 int bh_event_add_var(struct bh_event *event, int argv, const char *format, ...)
 {
-       static char buf[128];
+       char buf[128];
        char *s;
        va_list args;
        int len;