From: Philip Li <philip.li@intel.com>
To: kernel test robot <lkp@intel.com>
Cc: Christoph Hellwig <hch@lst.de>, <oe-kbuild-all@lists.linux.dev>,
<linux-kernel@vger.kernel.org>, Jens Axboe <axboe@kernel.dk>,
Kees Cook <keescook@chromium.org>
Subject: Re: drivers/target/target_core_transport.c:1079:59: warning: '%s' directive output may be truncated writing up to 253 bytes into a region of size 221
Date: Mon, 6 Nov 2023 22:59:29 +0800 [thread overview]
Message-ID: <ZUj/USPCJ6tm/lg9@rli9-mobl> (raw)
In-Reply-To: <202311062106.HacLsl2Y-lkp@intel.com>
On Mon, Nov 06, 2023 at 10:01:44PM +0800, kernel test robot wrote:
> Hi Christoph,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
Sorry for false report, kindly ignore this which is not the cause of initial warning.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: d2f51b3516dade79269ff45eae2a7668ae711b25
> commit: 8a39a0478355e9dfdd2f35038d07c4ebe3192441 target: don't depend on SCSI
> date: 5 years ago
> config: x86_64-randconfig-x083-20230515 (https://download.01.org/0day-ci/archive/20231106/202311062106.HacLsl2Y-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/20231106/202311062106.HacLsl2Y-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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311062106.HacLsl2Y-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> drivers/target/target_core_transport.c: In function 'transport_dump_vpd_ident':
> >> drivers/target/target_core_transport.c:1079:59: warning: '%s' directive output may be truncated writing up to 253 bytes into a region of size 221 [-Wformat-truncation=]
> 1079 | "T10 VPD ASCII Device Identifier: %s\n",
> | ^~
> drivers/target/target_core_transport.c:1078:17: note: 'snprintf' output between 35 and 288 bytes into a destination of size 254
> 1078 | snprintf(buf, sizeof(buf),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 1079 | "T10 VPD ASCII Device Identifier: %s\n",
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1080 | &vpd->device_identifier[0]);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/target/target_core_transport.c:1084:59: warning: '%s' directive output may be truncated writing up to 253 bytes into a region of size 221 [-Wformat-truncation=]
> 1084 | "T10 VPD UTF-8 Device Identifier: %s\n",
> | ^~
> drivers/target/target_core_transport.c:1083:17: note: 'snprintf' output between 35 and 288 bytes into a destination of size 254
> 1083 | snprintf(buf, sizeof(buf),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 1084 | "T10 VPD UTF-8 Device Identifier: %s\n",
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1085 | &vpd->device_identifier[0]);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/target/target_core_transport.c:1074:60: warning: '%s' directive output may be truncated writing up to 253 bytes into a region of size 220 [-Wformat-truncation=]
> 1074 | "T10 VPD Binary Device Identifier: %s\n",
> | ^~
> drivers/target/target_core_transport.c:1073:17: note: 'snprintf' output between 36 and 289 bytes into a destination of size 254
> 1073 | snprintf(buf, sizeof(buf),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 1074 | "T10 VPD Binary Device Identifier: %s\n",
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1075 | &vpd->device_identifier[0]);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/target/target_core_transport.o: warning: objtool: transport_init_session()+0x61: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_alloc_session_tags()+0x80: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_read_prot_action()+0x156: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_handle_queue_full()+0x2ac: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_lun_remove_cmd()+0x1e3: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: __transport_check_aborted_status()+0x2e2: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_setup_cmd_from_cdb()+0x540: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_show_dynamic_sessions()+0xf6: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_put_nacl()+0x10b: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_free_session()+0x136: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_init_session_tags()+0x66: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: translate_sense_reason.constprop.0()+0x1aa: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_send_check_condition_and_sense()+0x357: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: __transport_wait_for_tasks()+0x245: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_generic_free_cmd()+0x1a5: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: init_se_kmem_caches()+0x2b: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_dump_vpd_ident_type()+0x144: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_cmd_size_check()+0x3f3: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_generic_map_mem_to_cmd()+0x7c: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_complete_ok_work()+0xa6e: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_complete_qf()+0x266: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_generic_request_failure()+0x4ae: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_write_prot_action()+0x156: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_handle_cdb_direct()+0x39: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: target_submit_cmd_map_sgls()+0x3af: sibling call from callable instruction with modified stack frame
> drivers/target/target_core_transport.o: warning: objtool: transport_send_task_abort()+0x2a7: sibling call from callable instruction with modified stack frame
>
>
> vim +1079 drivers/target/target_core_transport.c
>
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1060
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1061 int transport_dump_vpd_ident(
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1062 struct t10_vpd *vpd,
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1063 unsigned char *p_buf,
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1064 int p_buf_len)
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1065 {
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1066 unsigned char buf[VPD_TMP_BUF_SIZE];
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1067 int ret = 0;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1068
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1069 memset(buf, 0, VPD_TMP_BUF_SIZE);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1070
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1071 switch (vpd->device_identifier_code_set) {
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1072 case 0x01: /* Binary */
> 703d641d870346 Dan Carpenter 2013-01-18 1073 snprintf(buf, sizeof(buf),
> 703d641d870346 Dan Carpenter 2013-01-18 1074 "T10 VPD Binary Device Identifier: %s\n",
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1075 &vpd->device_identifier[0]);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1076 break;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1077 case 0x02: /* ASCII */
> 703d641d870346 Dan Carpenter 2013-01-18 1078 snprintf(buf, sizeof(buf),
> 703d641d870346 Dan Carpenter 2013-01-18 @1079 "T10 VPD ASCII Device Identifier: %s\n",
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1080 &vpd->device_identifier[0]);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1081 break;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1082 case 0x03: /* UTF-8 */
> 703d641d870346 Dan Carpenter 2013-01-18 1083 snprintf(buf, sizeof(buf),
> 703d641d870346 Dan Carpenter 2013-01-18 1084 "T10 VPD UTF-8 Device Identifier: %s\n",
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1085 &vpd->device_identifier[0]);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1086 break;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1087 default:
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1088 sprintf(buf, "T10 VPD Device Identifier encoding unsupported:"
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1089 " 0x%02x", vpd->device_identifier_code_set);
> e3d6f909ed803d Andy Grover 2011-07-19 1090 ret = -EINVAL;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1091 break;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1092 }
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1093
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1094 if (p_buf)
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1095 strncpy(p_buf, buf, p_buf_len);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1096 else
> 6708bb27bb2703 Andy Grover 2011-06-08 1097 pr_debug("%s", buf);
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1098
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1099 return ret;
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1100 }
> c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17 1101
>
> :::::: The code at line 1079 was first introduced by commit
> :::::: 703d641d87034629f8b0da94334034ed5d805b36 target: change sprintf to snprintf in transport_dump_vpd_ident
>
> :::::: TO: Dan Carpenter <dan.carpenter@oracle.com>
> :::::: CC: Nicholas Bellinger <nab@linux-iscsi.org>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
next prev parent reply other threads:[~2023-11-06 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 14:01 kernel test robot
2023-11-06 14:59 ` Philip Li [this message]
2023-11-08 7:32 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUj/USPCJ6tm/lg9@rli9-mobl \
--to=philip.li@intel.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®