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 D8190EB64D7 for ; Thu, 22 Jun 2023 02:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjFVCtK (ORCPT ); Wed, 21 Jun 2023 22:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjFVCtI (ORCPT ); Wed, 21 Jun 2023 22:49:08 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D4BE1BC3 for ; Wed, 21 Jun 2023 19:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687402147; x=1718938147; h=date:from:to:cc:subject:message-id:mime-version; bh=5QjLcdbcadTKTQxis9Ri4vrpkA81trw4pcIakR/OOMw=; b=AG21MYgmJ04I1nc6r1pL6kC9xRbrjvMNDf7Sh4zqXVGEiSk1cq9z0DBR qp3osKYnQ/lHo/JkCEFwoxgP4xz7JIOSjylL1pNyySXGCTqLM0Xb0hFvl xBzjoUdhqPFiXqqeOCMOxujvbglYoVRPJ+WBcxIQqZjSR8nqBM9mq5L5T WvzOmg7FMQ+aIejPpEXYV10fy11AUaElMH0JlyNaF6sSlMA6/DmDpnOJo iBeTFZa/3DbHtUr5Ahye7PoJUgglC8tk++p5ntHvWQuvvdovb0DMdnjlV 4oirc/wVHt2+gVBM6+KsFCzKMQbvVcRpcbe6wRRabV6mVQdz0XZUnWjxj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="339976572" X-IronPort-AV: E=Sophos;i="6.00,262,1681196400"; d="scan'208";a="339976572" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 19:48:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="784740117" X-IronPort-AV: E=Sophos;i="6.00,262,1681196400"; d="scan'208";a="784740117" Received: from lkp-server01.sh.intel.com (HELO 783282924a45) ([10.239.97.150]) by fmsmga004.fm.intel.com with ESMTP; 21 Jun 2023 19:48:27 -0700 Received: from kbuild by 783282924a45 with local (Exim 4.96) (envelope-from ) id 1qCAN0-0007HW-32; Thu, 22 Jun 2023 02:48:26 +0000 Date: Thu, 22 Jun 2023 10:48:10 +0800 From: kernel test robot To: Huazhong Tan Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org Subject: drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument Message-ID: <202306221038.epkS842w-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 Hi Huazhong, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: dad9774deaf1cf8e8f7483310dfb2690310193d2 commit: 77e9184869c9fb00a482357ea8eef3bd7ae3d45a net: hns3: refactor dump bd info of debugfs date: 2 years, 1 month ago config: arm64-defconfig (https://download.01.org/0day-ci/archive/20230622/202306221038.epkS842w-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221038.epkS842w-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/202306221038.epkS842w-lkp@intel.com/ All warnings (new ones prefixed by >>): In function 'hns3_dbg_fill_content', inlined from 'hns3_dbg_rx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:358:2: >> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation] 127 | strncpy(pos, items[i].name, strlen(items[i].name)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'hns3_dbg_fill_content', inlined from 'hns3_dbg_rx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:367:3: drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:125:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation] 125 | strncpy(pos, result[i], strlen(result[i])); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'hns3_dbg_fill_content', inlined from 'hns3_dbg_tx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:432:2: >> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation] 127 | strncpy(pos, items[i].name, strlen(items[i].name)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'hns3_dbg_fill_content', inlined from 'hns3_dbg_tx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:441:3: drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:125:25: warning: 'strncpy' specified bound depends on the length of the source argument [-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 https://github.com/intel/lkp-tests/wiki