From ca8b4c67d0ed293ad92b0bf08e37b688d92ac72c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 9 Jan 2012 01:08:58 +0200 Subject: [PATCH 1/4] a few cosmetic changes Signed-off-by: Ran Benita --- configure.ac | 4 ++-- src/console.c | 2 +- src/eloop.c | 2 +- src/input_xkb.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index dabb33e..d4db1e3 100644 --- a/configure.ac +++ b/configure.ac @@ -67,7 +67,7 @@ AC_ARG_ENABLE([pango], AC_MSG_RESULT([$force_pango]) if test x$force_pango = xyes -a $have_pango = xno ; then - AC_ERROR([Pango library not found]) + AC_ERROR([Pango library not found]) fi AM_CONDITIONAL([USE_PANGO], [test x$force_pango = xyes]) @@ -80,7 +80,7 @@ AM_CONDITIONAL([DEBUG], [test x$debug = xyes]) AC_MSG_RESULT([$debug]) if test ! x$debug = xyes ; then - AC_DEFINE([NDEBUG], [1], [No Debug]) + AC_DEFINE([NDEBUG], [1], [No Debug]) fi AC_CONFIG_FILES([Makefile]) diff --git a/src/console.c b/src/console.c index d0ab596..a8f9a50 100644 --- a/src/console.c +++ b/src/console.c @@ -209,7 +209,7 @@ void kmscon_console_unref(struct kmscon_console *con) kmscon_buffer_unref(con->cells); kmscon_font_factory_unref(con->ff); free(con); - log_debug("console: destroing console\n"); + log_debug("console: destroying console\n"); } unsigned int kmscon_console_get_width(struct kmscon_console *con) diff --git a/src/eloop.c b/src/eloop.c index 8b05ca7..e25cd36 100644 --- a/src/eloop.c +++ b/src/eloop.c @@ -545,7 +545,7 @@ int kmscon_eloop_dispatch(struct kmscon_eloop *loop, int timeout) /* dispatch fd events */ count = epoll_wait(loop->efd, ep, 32, timeout); if (count < 0) { - log_warning("eloop: epoll_wait dispatching failed\n"); + log_warning("eloop: epoll_wait dispatching failed: %m\n"); return -errno; } diff --git a/src/input_xkb.c b/src/input_xkb.c index ae479f9..bf2c609 100644 --- a/src/input_xkb.c +++ b/src/input_xkb.c @@ -667,7 +667,7 @@ bool kmscon_xkb_process_evdev_key(struct xkb_desc *desc, struct kmscon_input_event *out) { KeyCode keycode; - uint8_t group; + uint8_t group; uint16_t shift_level; uint32_t sym; union xkb_action *action; From bb5f1dde5833ab569820f81873ca40435f8fcb42 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 9 Jan 2012 01:14:11 +0200 Subject: [PATCH 2/4] font_pango: fix uninitialized variable Signed-off-by: Ran Benita --- src/font_pango.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/font_pango.c b/src/font_pango.c index aec3dfe..8fd12fe 100644 --- a/src/font_pango.c +++ b/src/font_pango.c @@ -286,6 +286,7 @@ static int measure_width(struct kmscon_font *font) if (!font) return -EINVAL; + width = 0; num = 0; for (i = 0; i < 127; ++i) { ch = kmscon_symbol_make(i); From e118e167084c32d2362248151e0e3740a1f391df Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 31 Dec 2011 12:31:53 +0200 Subject: [PATCH 3/4] test_console: fix use-after-free Here's how it goes: 1. stdin reaches EOF, kmscon_eloop_rm_fd is called on stdin_fd. 2. The fd object is freed, the memory is reused in the meantime. 3. rm_fd is called again in destroy_eloop. 4. con->stdin_fd points to garbage and we get a segmentation fault. Signed-off-by: Ran Benita --- tests/test_console.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_console.c b/tests/test_console.c index 810e5c7..9e72499 100644 --- a/tests/test_console.c +++ b/tests/test_console.c @@ -96,6 +96,7 @@ static void stdin_cb(struct kmscon_fd *fd, int mask, void *data) } else if (!ret) { log_info("stdin closed\n"); kmscon_eloop_rm_fd(fd); + con->stdin_fd = NULL; } else { len = ret; log_debug("stdin input read (len: %d)\n", len); From 30db190ceb48469645a85f123528266318b585bb Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 31 Dec 2011 12:39:09 +0200 Subject: [PATCH 4/4] Fix compiler sign-mismatch warnings Signed-off-by: Ran Benita --- src/eloop.c | 2 +- src/output.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eloop.c b/src/eloop.c index e25cd36..60ec78a 100644 --- a/src/eloop.c +++ b/src/eloop.c @@ -296,7 +296,7 @@ int kmscon_eloop_add_fd(struct kmscon_eloop *loop, struct kmscon_fd *fd, void kmscon_eloop_rm_fd(struct kmscon_fd *fd) { struct kmscon_eloop *loop; - int i; + size_t i; if (!fd || !fd->loop) return; diff --git a/src/output.c b/src/output.c index b3e0669..3bf215b 100644 --- a/src/output.c +++ b/src/output.c @@ -1131,8 +1131,8 @@ int kmscon_compositor_refresh(struct kmscon_compositor *comp) { drmModeConnector *conn; drmModeRes *res; - size_t i; - int cid; + int i; + uint32_t cid; struct kmscon_output *output, *tmp; if (!comp || comp->state != COMPOSITOR_AWAKE)