From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 682FBCDB474 for ; Tue, 17 Oct 2023 17:42:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343907AbjJQRmU (ORCPT ); Tue, 17 Oct 2023 13:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234619AbjJQRmS (ORCPT ); Tue, 17 Oct 2023 13:42:18 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9CB79B for ; Tue, 17 Oct 2023 10:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697564536; x=1729100536; h=date:from:to:cc:subject:message-id:mime-version; bh=fCsPKwu83AR50+1nyaI7BU6yYuUMjwt4daXr2H6j1Jk=; b=eA7fzQ/iZrHXOiZmzWPqhQcDj6ovrH7OmTtewzuRA6E+fGwnalmsxxGr DVTRR5zqEXKStuBCkhzgPhvbqp2UKN5CR/73jSJSIc3BcAjKDH7E7DuXl wW9Uiwg2fNNiWGAiF5Iwiacm1rxOwrWRRcXX0lU12M8Q0xtlF+Z8U30hz NXzyf3I/R9BjkHcWI1ZVInUijkdhE7x0BZSf+xezupGA3TeS2FCrj6jxy fwyZFLFpVehxELgFi2C9PU5o0GGMCZeWS97bQnGchxZc19EKypNgtBnGv zcwhmUkLG68rrGug1+QUiQ/YJCtda+lc57X42ehpHC2iV1K16paHsxDFC w==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="384724104" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="384724104" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 10:42:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="846907003" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="846907003" Received: from lkp-server02.sh.intel.com (HELO f64821696465) ([10.239.97.151]) by FMSMGA003.fm.intel.com with ESMTP; 17 Oct 2023 10:42:15 -0700 Received: from kbuild by f64821696465 with local (Exim 4.96) (envelope-from ) id 1qso56-0009u9-13; Tue, 17 Oct 2023 17:42:12 +0000 Date: Wed, 18 Oct 2023 01:41:29 +0800 From: kernel test robot To: Vlastimil Babka Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Christoph Lameter Subject: include/linux/fortify-string.h:55:33: warning: '__builtin_strncpy' specified bound 30 equals destination size Message-ID: <202310180153.kXs18a7s-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 213f891525c222e8ed145ce1ce7ae1f47921cb9c commit: e240e53ae0abb0896e0f399bdfef41c69cec3123 mm, slub: add CONFIG_SLUB_TINY date: 11 months ago config: x86_64-randconfig-m031-20230109 (https://download.01.org/0day-ci/archive/20231018/202310180153.kXs18a7s-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310180153.kXs18a7s-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202310180153.kXs18a7s-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from include/linux/string.h:253, from include/linux/bitmap.h:11, 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:22, from arch/x86/include/asm/cpufeature.h:5, from arch/x86/include/asm/thread_info.h:53, from include/linux/thread_info.h:60, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:78, from include/linux/spinlock.h:56, from include/linux/mmzone.h:8, from include/linux/memremap.h:5, from drivers/dax/bus.c:3: In function 'strncpy', inlined from 'do_id_store' at drivers/dax/bus.c:87:5: >> include/linux/fortify-string.h:55:33: warning: '__builtin_strncpy' specified bound 30 equals destination size [-Wstringop-truncation] 55 | #define __underlying_strncpy __builtin_strncpy | ^ include/linux/fortify-string.h:131:16: note: in expansion of macro '__underlying_strncpy' 131 | return __underlying_strncpy(p, q, size); | ^~~~~~~~~~~~~~~~~~~~ -- In file included from include/linux/string.h:253, from include/linux/bitmap.h:11, 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:22, from arch/x86/include/asm/timex.h:5, from include/linux/timex.h:67, from include/linux/time32.h:13, from include/linux/time.h:60, from include/linux/stat.h:19, from include/linux/module.h:13, from drivers/nvme/target/core.c:7: In function 'strncpy', inlined from '__assign_req_name' at drivers/nvme/target/trace.h:56:2: >> include/linux/fortify-string.h:55:33: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation] 55 | #define __underlying_strncpy __builtin_strncpy | ^ include/linux/fortify-string.h:131:16: note: in expansion of macro '__underlying_strncpy' 131 | return __underlying_strncpy(p, q, size); | ^~~~~~~~~~~~~~~~~~~~ In function '__fortify_strlen', inlined from '__assign_req_name' at drivers/nvme/target/trace.h:57:3: include/linux/fortify-string.h:53:33: note: length computed here 53 | #define __underlying_strlen __builtin_strlen | ^ include/linux/fortify-string.h:183:24: note: in expansion of macro '__underlying_strlen' 183 | return __underlying_strlen(p); | ^~~~~~~~~~~~~~~~~~~ In function 'fortify_memcpy_chk', inlined from 'perf_trace_nvmet_req_init' at drivers/nvme/target/./trace.h:61:1: include/linux/fortify-string.h:400:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning] 400 | __read_overflow2_field(q_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'fortify_memcpy_chk', inlined from 'trace_event_raw_event_nvmet_req_init' at drivers/nvme/target/./trace.h:61:1: include/linux/fortify-string.h:400:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning] 400 | __read_overflow2_field(q_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/__builtin_strncpy +55 include/linux/fortify-string.h 3009f891bb9f32 Kees Cook 2021-08-02 33 a28a6e860c6cf2 Francis Laniel 2021-02-25 34 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) a28a6e860c6cf2 Francis Laniel 2021-02-25 35 extern void *__underlying_memchr(const void *p, int c, __kernel_size_t size) __RENAME(memchr); a28a6e860c6cf2 Francis Laniel 2021-02-25 36 extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp); a28a6e860c6cf2 Francis Laniel 2021-02-25 37 extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy); a28a6e860c6cf2 Francis Laniel 2021-02-25 38 extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove); a28a6e860c6cf2 Francis Laniel 2021-02-25 39 extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset); a28a6e860c6cf2 Francis Laniel 2021-02-25 40 extern char *__underlying_strcat(char *p, const char *q) __RENAME(strcat); a28a6e860c6cf2 Francis Laniel 2021-02-25 41 extern char *__underlying_strcpy(char *p, const char *q) __RENAME(strcpy); a28a6e860c6cf2 Francis Laniel 2021-02-25 42 extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen); a28a6e860c6cf2 Francis Laniel 2021-02-25 43 extern char *__underlying_strncat(char *p, const char *q, __kernel_size_t count) __RENAME(strncat); a28a6e860c6cf2 Francis Laniel 2021-02-25 44 extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size) __RENAME(strncpy); a28a6e860c6cf2 Francis Laniel 2021-02-25 45 #else a28a6e860c6cf2 Francis Laniel 2021-02-25 46 #define __underlying_memchr __builtin_memchr a28a6e860c6cf2 Francis Laniel 2021-02-25 47 #define __underlying_memcmp __builtin_memcmp a28a6e860c6cf2 Francis Laniel 2021-02-25 48 #define __underlying_memcpy __builtin_memcpy a28a6e860c6cf2 Francis Laniel 2021-02-25 49 #define __underlying_memmove __builtin_memmove a28a6e860c6cf2 Francis Laniel 2021-02-25 50 #define __underlying_memset __builtin_memset a28a6e860c6cf2 Francis Laniel 2021-02-25 51 #define __underlying_strcat __builtin_strcat a28a6e860c6cf2 Francis Laniel 2021-02-25 52 #define __underlying_strcpy __builtin_strcpy a28a6e860c6cf2 Francis Laniel 2021-02-25 53 #define __underlying_strlen __builtin_strlen a28a6e860c6cf2 Francis Laniel 2021-02-25 54 #define __underlying_strncat __builtin_strncat a28a6e860c6cf2 Francis Laniel 2021-02-25 @55 #define __underlying_strncpy __builtin_strncpy a28a6e860c6cf2 Francis Laniel 2021-02-25 56 #endif a28a6e860c6cf2 Francis Laniel 2021-02-25 57 :::::: The code at line 55 was first introduced by commit :::::: a28a6e860c6cf231cf3c5171c75c342adcd00406 string.h: move fortified functions definitions in a dedicated header. :::::: TO: Francis Laniel :::::: CC: Linus Torvalds -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki