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 36CDFC433F5 for ; Tue, 4 Jan 2022 12:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbiADMD1 (ORCPT ); Tue, 4 Jan 2022 07:03:27 -0500 Received: from mga02.intel.com ([134.134.136.20]:21358 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiADMD0 (ORCPT ); Tue, 4 Jan 2022 07:03:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641297806; x=1672833806; h=date:from:to:cc:subject:message-id:mime-version; bh=1XgMCz4Mlnr2ia8fv8lQ+vtO7J2ecggPe6ov0PaY83c=; b=Gdj80k5LN6kaKcziMVIW/Q2gUdVtk/FznFrutJdYOTYsKPP4KJs3kw5J SfyFjQN/rWhjZOU22MdTewg7C8pGq0lyqN0enL+7/X7y/9eRPRQc2JEg6 BFZrSvcfVIsT1mCEqmVi/3wOAya3qsr7JkJSoz6NrfxNS8mDxykUoN9O7 olqQ5+5kaHEJvIKRQpaNkjJh8AyUqkg2pr86c11/aRqphbNN5t1EgsRzJ Jth43ADR4rEm091JG2kYnHFIkC4Fi5Z82opiwCXMQTmyzEut+mlRjHqiw 4RnijAVySxFvA3psVTQh66feaa6yizQINystLi4QdJ8QrXNncDRvaoGj2 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10216"; a="229527591" X-IronPort-AV: E=Sophos;i="5.88,260,1635231600"; d="scan'208";a="229527591" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2022 04:02:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,260,1635231600"; d="scan'208";a="667723301" Received: from lkp-server01.sh.intel.com (HELO e357b3ef1427) ([10.239.97.150]) by fmsmga001.fm.intel.com with ESMTP; 04 Jan 2022 04:02:48 -0800 Received: from kbuild by e357b3ef1427 with local (Exim 4.92) (envelope-from ) id 1n4iWd-000FIc-Fg; Tue, 04 Jan 2022 12:02:47 +0000 Date: Tue, 4 Jan 2022 20:02:30 +0800 From: kernel test robot To: Huazhong Tan Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:4: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length Message-ID: <202201041959.jwL02W69-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: c9e6606c7fe92b50a02ce51dda82586ebdf99b48 commit: 77e9184869c9fb00a482357ea8eef3bd7ae3d45a net: hns3: refactor dump bd info of debugfs date: 8 months ago config: x86_64-buildonly-randconfig-r006-20220103 (https://download.01.org/0day-ci/archive/20220104/202201041959.jwL02W69-lkp@intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=77e9184869c9fb00a482357ea8eef3bd7ae3d45a git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 77e9184869c9fb00a482357ea8eef3bd7ae3d45a # save the config file to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/ethernet/hisilicon/hns3/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c: In function 'hns3_dbg_fill_content.constprop': >> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:4: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] 127 | strncpy(pos, items[i].name, strlen(items[i].name)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:125:4: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] 125 | strncpy(pos, result[i], strlen(result[i])); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/strncpy +127 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c 114 115 static void hns3_dbg_fill_content(char *content, u16 len, 116 const struct hns3_dbg_item *items, 117 const char **result, u16 size) 118 { 119 char *pos = content; 120 u16 i; 121 122 memset(content, ' ', len); 123 for (i = 0; i < size; i++) { 124 if (result) 125 strncpy(pos, result[i], strlen(result[i])); 126 else > 127 strncpy(pos, items[i].name, strlen(items[i].name)); 128 129 pos += strlen(items[i].name) + items[i].interval; 130 } 131 132 *pos++ = '\n'; 133 *pos++ = '\0'; 134 } 135 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org