From patchwork Thu Sep 10 10:47:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7153491 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 51A119F1D3 for ; Thu, 10 Sep 2015 10:56:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83D5820880 for ; Thu, 10 Sep 2015 10:56:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ACFF42087F for ; Thu, 10 Sep 2015 10:56:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0F756E536; Thu, 10 Sep 2015 03:56:25 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id B15D16E536 for ; Thu, 10 Sep 2015 03:56:24 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 10 Sep 2015 03:56:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,504,1437462000"; d="scan'208";a="786539653" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by fmsmga001.fm.intel.com with ESMTP; 10 Sep 2015 03:56:23 -0700 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Thu, 10 Sep 2015 11:47:07 +0100 Message-Id: <1441882027-23333-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441822740.5139.9.camel@intel.com> References: <1441822740.5139.9.camel@intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t] lib: don't use igt_warn in signal handlers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP igt_wan and other log functions are not async-signal safe, so should not be used in signal handlers. Reported-by: Paulo Zanoni Signed-off-by: Thomas Wood --- lib/igt_aux.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/igt_aux.c b/lib/igt_aux.c index e77392c..04ca25b 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -47,6 +47,7 @@ #include #include #include +#include #include "drmtest.h" #include "i915_drm.h" @@ -769,9 +770,13 @@ static void igt_module_param_exit_handler(int sig) if (fd >= 0) { int size = strlen (data->original_value); - if (size != write(fd, data->original_value, size)) - igt_warn("%s may not have been reset to its" - " original value\n", file_path); + if (size != write(fd, data->original_value, size)) { + const char msg[] = "WARNING: Module parameters " + "may not have been reset to their " + "original values\n"; + assert(write(STDERR_FILENO, msg, sizeof(msg)) + == sizeof(msg)); + } close(fd); }