[linux-stable-rc:linux-5.4.y 2248/3625] drivers/gpu/drm/i915/gt/intel_gt.c:335:2: error: format string is not a string literal (potentially insecure)

From: kernel test robot
Date: Tue May 17 2022 - 22:11:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head: 25f2e99af01b5b7328f55bbadab563cb26478289
commit: 1b5553c79d52f17e735cd924ff2178a2409e6d0b [2248/3625] drm/i915: Flush TLBs before releasing backing store
config: x86_64-randconfig-r031-20220516 (https://download.01.org/0day-ci/archive/20220518/202205180933.FHJdKHSI-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=1b5553c79d52f17e735cd924ff2178a2409e6d0b
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout 1b5553c79d52f17e735cd924ff2178a2409e6d0b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gt/intel_gt.c:335:2: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
GEM_TRACE("\n");
^~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_gem.h:68:24: note: expanded from macro 'GEM_TRACE'
#define GEM_TRACE(...) trace_printk(__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:716:3: note: expanded from macro 'trace_printk'
do_trace_printk(fmt, ##__VA_ARGS__); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:730:30: note: expanded from macro 'do_trace_printk'
__trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
^~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.c:335:2: note: treat the string as an argument to avoid this
drivers/gpu/drm/i915/i915_gem.h:68:24: note: expanded from macro 'GEM_TRACE'
#define GEM_TRACE(...) trace_printk(__VA_ARGS__)
^
include/linux/kernel.h:716:3: note: expanded from macro 'trace_printk'
do_trace_printk(fmt, ##__VA_ARGS__); \
^
include/linux/kernel.h:730:30: note: expanded from macro 'do_trace_printk'
__trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
^
1 error generated.


vim +335 drivers/gpu/drm/i915/gt/intel_gt.c

297
298 void intel_gt_invalidate_tlbs(struct intel_gt *gt)
299 {
300 static const i915_reg_t gen8_regs[] = {
301 [RENDER_CLASS] = GEN8_RTCR,
302 [VIDEO_DECODE_CLASS] = GEN8_M1TCR, /* , GEN8_M2TCR */
303 [VIDEO_ENHANCEMENT_CLASS] = GEN8_VTCR,
304 [COPY_ENGINE_CLASS] = GEN8_BTCR,
305 };
306 static const i915_reg_t gen12_regs[] = {
307 [RENDER_CLASS] = GEN12_GFX_TLB_INV_CR,
308 [VIDEO_DECODE_CLASS] = GEN12_VD_TLB_INV_CR,
309 [VIDEO_ENHANCEMENT_CLASS] = GEN12_VE_TLB_INV_CR,
310 [COPY_ENGINE_CLASS] = GEN12_BLT_TLB_INV_CR,
311 };
312 struct drm_i915_private *i915 = gt->i915;
313 struct intel_uncore *uncore = gt->uncore;
314 struct intel_engine_cs *engine;
315 enum intel_engine_id id;
316 const i915_reg_t *regs;
317 unsigned int num = 0;
318
319 if (I915_SELFTEST_ONLY(gt->awake == -ENODEV))
320 return;
321
322 if (INTEL_GEN(i915) == 12) {
323 regs = gen12_regs;
324 num = ARRAY_SIZE(gen12_regs);
325 } else if (INTEL_GEN(i915) >= 8 && INTEL_GEN(i915) <= 11) {
326 regs = gen8_regs;
327 num = ARRAY_SIZE(gen8_regs);
328 } else if (INTEL_GEN(i915) < 8) {
329 return;
330 }
331
332 if (WARN_ONCE(!num, "Platform does not implement TLB invalidation!"))
333 return;
334
> 335 GEM_TRACE("\n");

--
0-DAY CI Kernel Test Service
https://01.org/lkp