From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 4 23:20:09 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E27F106564A for ; Sun, 4 Mar 2012 23:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0ECC28FC17 for ; Sun, 4 Mar 2012 23:20:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q24NK8rS041354 for ; Sun, 4 Mar 2012 23:20:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q24NK8FI041353; Sun, 4 Mar 2012 23:20:08 GMT (envelope-from gnats) Resent-Date: Sun, 4 Mar 2012 23:20:08 GMT Resent-Message-Id: <201203042320.q24NK8FI041353@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Arne Meyer Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA9671065674 for ; Sun, 4 Mar 2012 23:10:33 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id ACF4E8FC20 for ; Sun, 4 Mar 2012 23:10:33 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q24NAXbe070858 for ; Sun, 4 Mar 2012 23:10:33 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q24NAXjm070856; Sun, 4 Mar 2012 23:10:33 GMT (envelope-from nobody) Message-Id: <201203042310.q24NAXjm070856@red.freebsd.org> Date: Sun, 4 Mar 2012 23:10:33 GMT From: Arne Meyer To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/165699: [patch] make sbin/mca compile with clang X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2012 23:20:09 -0000 >Number: 165699 >Category: bin >Synopsis: [patch] make sbin/mca compile with clang >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Mar 04 23:20:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Arne Meyer >Release: 9-STABLE >Organization: >Environment: FreeBSD partyvan 9.0-STABLE FreeBSD 9.0-STABLE #1 r232126M: Fri Feb 24 21:15:58 CET 2012 pk@partyvan: /usr/obj/usr/src/sys/PARTYVAN i386 >Description: partyvan# make CC=clang clang -O2 -pipe -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unus ed-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-s trings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-uninitialized -Wno-pointer-sign -c mca.c mca.c:473:11: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err(1, hw_mca_count); ^~~~~~~~~~~~ mca.c:480:11: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err(1, hw_mca_first); ^~~~~~~~~~~~ mca.c:484:11: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err(1, hw_mca_last); ^~~~~~~~~~~ 3 errors generated. *** Error code 1 >How-To-Repeat: >Fix: Patch attached with submission follows: --- mca.c.orig 2012-03-04 23:50:42.000000000 +0100 +++ mca.c 2012-03-04 23:53:11.000000000 +0100 @@ -55,10 +55,10 @@ #define HW_MCA_MAX_CPUID 255 -static char hw_mca_count[] = "hw.mca.count"; -static char hw_mca_first[] = "hw.mca.first"; -static char hw_mca_last[] = "hw.mca.last"; -static char hw_mca_recid[] = "hw.mca.%lu.%u"; +static const char hw_mca_count[] = "hw.mca.count"; +static const char hw_mca_first[] = "hw.mca.first"; +static const char hw_mca_last[] = "hw.mca.last"; +static const char hw_mca_recid[] = "hw.mca.%lu.%u"; static char default_dumpfile[] = "/var/log/mca.log"; @@ -487,7 +487,7 @@ error = 0; while (count && first <= last) { do { - sprintf(mib, hw_mca_recid, first, cpuid); + sprintf(mib, hw_mca_recid, (unsigned long)first, cpuid); len = 0; ch = sysctlbyname(mib, NULL, &len, NULL, 0); error = (ch == -1) ? errno : 0; >Release-Note: >Audit-Trail: >Unformatted: