From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F31523AC for ; Thu, 17 Feb 2022 07:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645084092; x=1676620092; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=99+dhgli+TBsASZWY8Mrl5qU4Lz7MyY/5DzeBpVia5E=; b=evx+9DmKQConkhRgTM5wiRPj4U6ymAwK3G6SvzhJMgGAMu07pnTHXGWs qYYVIwDFk0bQ9N+ezerLKLhb6Eq/83HXLAKypOmLuOnX5NwQ1sZlOkK7K oxWbjiylGxJ2O+QKrn3WG8Y7lODkrGgIDMXVIQ4SrVMW+KQbx9vwxRb+y 9sWpRLOj0AzL7oYqYnXz12wagItn3kH/6cnRunpSbNtVFkfSc3ixPnoCO EQdKugIBBibCoV4yYsqG7PvBPxgP+UModkS/uUPCVPOCpQgTef74Nu91O vGr4/MNEAN6gFr10gmsNdQYdigllVIY7VlyfADaxyUXIMlSK/KB8bahk9 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="249652809" X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="249652809" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:48:11 -0800 X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="636953141" Received: from acushion-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.21.45]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:48:07 -0800 From: Jani Nikula To: Nathan Chancellor , Tong Zhang Cc: Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Nick Desaulniers , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v2] drm/i915: fix build issue when using clang In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220214195821.29809-1-ztong0001@gmail.com> Date: Thu, 17 Feb 2022 09:48:04 +0200 Message-ID: <877d9u3pe3.fsf@intel.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, 15 Feb 2022, Nathan Chancellor wrote: > On Mon, Feb 14, 2022 at 11:58:20AM -0800, Tong Zhang wrote: >> drm/i915 adds some extra cflags, namely -Wall, which causes >> instances of -Wformat-security to appear when building with clang, even >> though this warning is turned off kernel-wide in the main Makefile: >> >> > drivers/gpu/drm/i915/gt/intel_gt.c:983:2: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] >> > GEM_TRACE("ERROR\n"); >> > ^~~~~~~~~~~~~~~~~~~~ >> > ./drivers/gpu/drm/i915/i915_gem.h:76:24: note: expanded from macro 'GEM_TRACE' >> > #define GEM_TRACE(...) trace_printk(__VA_ARGS__) >> > ^~~~~~~~~~~~~~~~~~~~~~~~~ >> > ./include/linux/kernel.h:369:3: note: expanded from macro 'trace_printk' >> > do_trace_printk(fmt, ##__VA_ARGS__); \ >> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> > ./include/linux/kernel.h:383:30: note: expanded from macro 'do_trace_printk' >> > __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ >> > ^~~~~~~~~~~~~~~~ >> >drivers/gpu/drm/i915/gt/intel_gt.c:983:2: note: treat the string as an argument to avoid this >> >> This does not happen with GCC because it does not enable >> -Wformat-security with -Wall. Disable -Wformat-security within the i915 >> Makefile so that these warnings do not show up with clang. >> >> Signed-off-by: Tong Zhang > > Given this is not enabled for GCC and it is disabled in the main > Makefile: > > Reviewed-by: Nathan Chancellor > > Additionally, it seems like trace_printk() is designed to be able to > take a string literal without a format argument, so this should be fine. Thanks for the patch and review, pushed to drm-intel-next. I appreciate the support in maintaining fairly strict warning levels in i915. BR, Jani. > >> --- >> >> v2: revise commit message >> >> drivers/gpu/drm/i915/Makefile | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile >> index 1b62b9f65196..c04e05a3d39f 100644 >> --- a/drivers/gpu/drm/i915/Makefile >> +++ b/drivers/gpu/drm/i915/Makefile >> @@ -13,6 +13,7 @@ >> # will most likely get a sudden build breakage... Hopefully we will fix >> # new warnings before CI updates! >> subdir-ccflags-y := -Wall -Wextra >> +subdir-ccflags-y += -Wno-format-security >> subdir-ccflags-y += -Wno-unused-parameter >> subdir-ccflags-y += -Wno-type-limits >> subdir-ccflags-y += -Wno-missing-field-initializers >> -- >> 2.25.1 >> >> -- Jani Nikula, Intel Open Source Graphics Center