[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201805290939.AjijeyJf%fengguang.wu@intel.com>
Date: Tue, 29 May 2018 09:35:43 +0800
From: kbuild test robot <lkp@...el.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: kbuild-all@...org, linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: include/linux/string.h:246:9: warning: '__builtin_strncpy' output
truncated before terminating nul copying 4 bytes from a string of the same
length
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 786b71f5b754273ccef6d9462e52062b3e1f9877
commit: 854e55ad289ef8888e7991f0ada85d5846f5afb9 objtool, perf: Fix GCC 8 -Wrestrict error
date: 2 months ago
config: x86_64-randconfig-s4-05290856 (attached as .config)
compiler: gcc-8 (Debian 8.1.0-3) 8.1.0
reproduce:
git checkout 854e55ad289ef8888e7991f0ada85d5846f5afb9
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:21,
from arch/x86/include/asm/cpufeature.h:5,
from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:10,
from drivers/video/fbdev/uvesafb.c:12:
In function 'strncpy',
inlined from 'uvesafb_vbe_getinfo' at drivers/video/fbdev/uvesafb.c:425:2:
>> include/linux/string.h:246:9: warning: '__builtin_strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/__builtin_strncpy +246 include/linux/string.h
6974f0c4 Daniel Micay 2017-07-12 237
6974f0c4 Daniel Micay 2017-07-12 238 #if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE)
6974f0c4 Daniel Micay 2017-07-12 239 __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size)
6974f0c4 Daniel Micay 2017-07-12 240 {
6974f0c4 Daniel Micay 2017-07-12 241 size_t p_size = __builtin_object_size(p, 0);
6974f0c4 Daniel Micay 2017-07-12 242 if (__builtin_constant_p(size) && p_size < size)
6974f0c4 Daniel Micay 2017-07-12 243 __write_overflow();
6974f0c4 Daniel Micay 2017-07-12 244 if (p_size < size)
6974f0c4 Daniel Micay 2017-07-12 245 fortify_panic(__func__);
6974f0c4 Daniel Micay 2017-07-12 @246 return __builtin_strncpy(p, q, size);
6974f0c4 Daniel Micay 2017-07-12 247 }
6974f0c4 Daniel Micay 2017-07-12 248
:::::: The code at line 246 was first introduced by commit
:::::: 6974f0c4555e285ab217cee58b6e874f776ff409 include/linux/string.h: add the option of fortified string.h functions
:::::: TO: Daniel Micay <danielmicay@...il.com>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (35030 bytes)
Powered by blists - more mailing lists