iscsi: fix the warning issue in tgt_node.c reported by vagrant.
The allocated size of buf is too large,i.e., 4096. And we will have host to be assigned with buf, host = buf. But the tmp_buf (destination) buffer is not so big. So restrict the buf size and make the vagrant happy. The max size of conn->target_addr is MAX_TARGET_ADDR, so add additional 2 is enough according the format to print. The warning is: /home/vagrant/spdk_repo/spdk/lib/iscsi/tgt_node.c:377:47: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 301 [-Wformat-truncation=] 00:03:02.381 377 | snprintf(tmp_buf, len + 1, "TargetAddress=%s:%s,%d", host, p->port, pg->tag); Signed-off-by: Ziye Yang <ziye.yang@intel.com> Change-Id: Ib64e7140d5e14909d2a86dd2d47413abe5cd027e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5092 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
7b0f650cff
commit
57833a5dff
@ -330,7 +330,7 @@ iscsi_send_tgt_portals(struct spdk_iscsi_conn *conn,
|
||||
uint8_t *data, int alloc_len, int total,
|
||||
int *previous_completed_len, bool *no_buf_space)
|
||||
{
|
||||
char buf[MAX_TMPBUF];
|
||||
char buf[MAX_TARGET_ADDR + 2];
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
struct spdk_iscsi_pg_map *pg_map;
|
||||
struct spdk_iscsi_portal *p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user