#define _GNU_SOURCE #include #include #include #include "cookie.h" static char const *priov[] = { [LOG_EMERG] = "EMERG:", [LOG_ALERT] = "ALERT:", [LOG_CRIT] = "CRIT:", [LOG_ERR] = "ERR:", [LOG_WARNING] = "WARNING:", [LOG_NOTICE] = "NOTICE:", [LOG_INFO] = "INFO:", [LOG_DEBUG] = "DEBUG:", }; static ssize_t cookie_writer(void *cookie, char const *data, size_t leng) { int prio = LOG_DEBUG, len; do { len = strlen(priov[prio]); } while (memcmp(data, priov[prio], len) && --prio >= 0); if (prio < 0) { prio = LOG_INFO; } else { data += len; leng -= len; } while (*data == ' ') { ++data; --leng; } syslog(prio, "%.*s", (int) leng, data); return leng; } static cookie_io_functions_t cookie_log = { .write = cookie_writer, }; void to_std_log(FILE **fp) { setvbuf(*fp = fopencookie(NULL, "w", cookie_log), NULL, _IOLBF, 0); } nput type='hidden' name='id' value='55cae7a403f3b52de3dd6e4a614582541c9631af'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-08-08 12:13:45 +0200
committerDavid Howells <dhowells@redhat.com>2016-08-09 10:51:38 +0100
commit55cae7a403f3b52de3dd6e4a614582541c9631af (patch)
tree83e7ce7e57b57abc3120132b411cb2182278fb63
parent1fe323aa1b2390a0c57fb0b06a782f128d49094c (diff)
rxrpc: fix uninitialized pointer dereference in debug code
A newly added bugfix caused an uninitialized variable to be used for printing debug output. This is harmless as long as the debug setting is disabled, but otherwise leads to an immediate crash. gcc warns about this when -Wmaybe-uninitialized is enabled: net/rxrpc/call_object.c: In function 'rxrpc_release_call': net/rxrpc/call_object.c:496:163: error: 'sp' may be used uninitialized in this function [-Werror=maybe-uninitialized] The initialization was removed but one of the users remains. This adds back the initialization. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 372ee16386bb ("rxrpc: Fix races between skb free, ACK generation and replying") Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--net/rxrpc/call_object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c