gpio-button-hotplug: fix data race
authorAndrey Erokhin <a.erokhin@inango-systems.com>
Wed, 6 Apr 2022 09:36:15 +0000 (12:36 +0300)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 9 Apr 2022 13:56:04 +0000 (15:56 +0200)
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>
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;