Bugzilla – Attachment 847561 Details for
Bug 1182804
GCC 11: fcoe-utils package fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
Test patch (not yet upstream) to make gcc-11 happy
0001-Fix-two-gcc-11-compiler-warnings.patch (text/plain), 2.18 KB, created by
Lee Duncan
on 2021-03-23 17:00:56 UTC
(
hide
)
Description:
Test patch (not yet upstream) to make gcc-11 happy
Filename:
MIME Type:
Creator:
Lee Duncan
Created:
2021-03-23 17:00:56 UTC
Size:
2.18 KB
patch
obsolete
>From 66616e988778c45a316d6b286fda732843f25297 Mon Sep 17 00:00:00 2001 >From: Lee Duncan <lduncan@suse.com> >Date: Mon, 22 Mar 2021 18:28:33 -0700 >Subject: [PATCH] Fix two gcc-11 compiler warnings. > >Gcc-11 is aggressive about gaurding against array copies. So be >clear about what we want to copy, and where we are copying it. > >Changes from V1: >* simplified both cases based on review comments >* no need to copy the data twice >--- > fcping.c | 8 ++++++-- > fipvlan.c | 11 +++++++++-- > 2 files changed, 15 insertions(+), 4 deletions(-) > >diff --git a/fcping.c b/fcping.c >index bf2bc0f0c785..21830a52524e 100644 >--- a/fcping.c >+++ b/fcping.c >@@ -570,6 +570,7 @@ fp_ns_get_id(uint32_t op, fc_wwn_t wwn, char *response, size_t *resp_len) > struct sg_io_v4 sg_io; > size_t actual_len; > int cmd, rc = 0; >+ uint32_t *uct = (uint32_t *)&ct.hdr; > > memset((char *)&cdb, 0, sizeof(cdb)); > memset(&ct, 0, sizeof(ct)); >@@ -584,8 +585,11 @@ fp_ns_get_id(uint32_t op, fc_wwn_t wwn, char *response, size_t *resp_len) > > cdb.msgcode = FC_BSG_HST_CT; > hton24(cdb.rqst_data.h_ct.port_id, 0xfffffc); >- memcpy(&cdb.rqst_data.h_ct.preamble_word0, &ct.hdr, >- 3 * sizeof(uint32_t)); >+ >+ /* copy preamble words one at a time, to make compiler happy */ >+ cdb.rqst_data.h_ct.preamble_word0 = uct[0]; >+ cdb.rqst_data.h_ct.preamble_word1 = uct[1]; >+ cdb.rqst_data.h_ct.preamble_word2 = uct[2]; > > sg_io.guard = 'Q'; > sg_io.protocol = BSG_PROTOCOL_SCSI; >diff --git a/fipvlan.c b/fipvlan.c >index c8a073393141..4433c0abf76e 100644 >--- a/fipvlan.c >+++ b/fipvlan.c >@@ -447,8 +447,15 @@ static void rtnl_recv_newlink(struct nlmsghdr *nh) > iff->iflink = *(int *)RTA_DATA(ifla[IFLA_LINK]); > else > iff->iflink = iff->ifindex; >- memcpy(iff->mac_addr, RTA_DATA(ifla[IFLA_ADDRESS]), ETHER_ADDR_LEN); >- strncpy(iff->ifname, RTA_DATA(ifla[IFLA_IFNAME]), IFNAMSIZ); >+ >+ /* >+ * copy MAC address and interface name using intermediate >+ * arrays, so gcc-11 knows we are not overflowing buffers >+ */ >+ if (ifla[IFLA_ADDRESS]) >+ memcpy(iff->mac_addr, RTA_DATA(ifla[IFLA_ADDRESS]), ETHER_ADDR_LEN); >+ if (ifla[IFLA_IFNAME]) >+ memcpy(iff->ifname, RTA_DATA(ifla[IFLA_IFNAME]), IFNAMSIZ); > iff->ifname[IFNAMSIZ - 1] = '\0'; > > if (ifla[IFLA_LINKINFO]) { >-- >2.26.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 1182804
:
847477
| 847561