From: Greg Kroah-Hartman Date: Tue, 6 Aug 2019 18:44:08 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.2.8~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a30ee3f8c649e6f8ac28e6f80c94f4d18eb509e;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: gcc-9-don-t-warn-about-uninitialized-variable.patch scsi-fcoe-embed-fc_rport_priv-in-fcoe_rport-structure.patch --- diff --git a/queue-4.19/gcc-9-don-t-warn-about-uninitialized-variable.patch b/queue-4.19/gcc-9-don-t-warn-about-uninitialized-variable.patch new file mode 100644 index 00000000000..363b33747fc --- /dev/null +++ b/queue-4.19/gcc-9-don-t-warn-about-uninitialized-variable.patch @@ -0,0 +1,34 @@ +From cf676908846a06443fa5e6724ca3f5dd7460eca1 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Wed, 1 May 2019 11:07:40 -0700 +Subject: gcc-9: don't warn about uninitialized variable + +From: Linus Torvalds + +commit cf676908846a06443fa5e6724ca3f5dd7460eca1 upstream. + +I'm not sure what made gcc warn about this code now. The 'ret' variable +does end up initialized in all cases, but it's definitely not obvious, +so the compiler is quite reasonable to warn about this. + +So just add initialization to make it all much more obvious both to +compilers and to humans. + +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/i2c-core-base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i + int i2c_generic_scl_recovery(struct i2c_adapter *adap) + { + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; +- int i = 0, scl = 1, ret; ++ int i = 0, scl = 1, ret = 0; + + if (bri->prepare_recovery) + bri->prepare_recovery(adap); diff --git a/queue-4.19/scsi-fcoe-embed-fc_rport_priv-in-fcoe_rport-structure.patch b/queue-4.19/scsi-fcoe-embed-fc_rport_priv-in-fcoe_rport-structure.patch new file mode 100644 index 00000000000..2212b35d46c --- /dev/null +++ b/queue-4.19/scsi-fcoe-embed-fc_rport_priv-in-fcoe_rport-structure.patch @@ -0,0 +1,221 @@ +From 023358b136d490ca91735ac6490db3741af5a8bd Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 24 Jul 2019 11:00:55 +0200 +Subject: scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure + +From: Hannes Reinecke + +commit 023358b136d490ca91735ac6490db3741af5a8bd upstream. + +Gcc-9 complains for a memset across pointer boundaries, which happens as +the code tries to allocate a flexible array on the stack. Turns out we +cannot do this without relying on gcc-isms, so with this patch we'll embed +the fc_rport_priv structure into fcoe_rport, can use the normal +'container_of' outcast, and will only have to do a memset over one +structure. + +Signed-off-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/fcoe/fcoe_ctlr.c | 51 ++++++++++++++++-------------------------- + drivers/scsi/libfc/fc_rport.c | 5 +++- + include/scsi/libfcoe.h | 1 + 3 files changed, 25 insertions(+), 32 deletions(-) + +--- a/drivers/scsi/fcoe/fcoe_ctlr.c ++++ b/drivers/scsi/fcoe/fcoe_ctlr.c +@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); + */ + static inline struct fcoe_rport *fcoe_ctlr_rport(struct fc_rport_priv *rdata) + { +- return (struct fcoe_rport *)(rdata + 1); ++ return container_of(rdata, struct fcoe_rport, rdata); + } + + /** +@@ -2281,7 +2281,7 @@ static void fcoe_ctlr_vn_start(struct fc + */ + static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, + struct sk_buff *skb, +- struct fc_rport_priv *rdata) ++ struct fcoe_rport *frport) + { + struct fip_header *fiph; + struct fip_desc *desc = NULL; +@@ -2289,16 +2289,12 @@ static int fcoe_ctlr_vn_parse(struct fco + struct fip_wwn_desc *wwn = NULL; + struct fip_vn_desc *vn = NULL; + struct fip_size_desc *size = NULL; +- struct fcoe_rport *frport; + size_t rlen; + size_t dlen; + u32 desc_mask = 0; + u32 dtype; + u8 sub; + +- memset(rdata, 0, sizeof(*rdata) + sizeof(*frport)); +- frport = fcoe_ctlr_rport(rdata); +- + fiph = (struct fip_header *)skb->data; + frport->flags = ntohs(fiph->fip_flags); + +@@ -2361,15 +2357,17 @@ static int fcoe_ctlr_vn_parse(struct fco + if (dlen != sizeof(struct fip_wwn_desc)) + goto len_err; + wwn = (struct fip_wwn_desc *)desc; +- rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); ++ frport->rdata.ids.node_name = ++ get_unaligned_be64(&wwn->fd_wwn); + break; + case FIP_DT_VN_ID: + if (dlen != sizeof(struct fip_vn_desc)) + goto len_err; + vn = (struct fip_vn_desc *)desc; + memcpy(frport->vn_mac, vn->fd_mac, ETH_ALEN); +- rdata->ids.port_id = ntoh24(vn->fd_fc_id); +- rdata->ids.port_name = get_unaligned_be64(&vn->fd_wwpn); ++ frport->rdata.ids.port_id = ntoh24(vn->fd_fc_id); ++ frport->rdata.ids.port_name = ++ get_unaligned_be64(&vn->fd_wwpn); + break; + case FIP_DT_FC4F: + if (dlen != sizeof(struct fip_fc4_feat)) +@@ -2750,10 +2748,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe + { + struct fip_header *fiph; + enum fip_vn2vn_subcode sub; +- struct { +- struct fc_rport_priv rdata; +- struct fcoe_rport frport; +- } buf; ++ struct fcoe_rport frport = { }; + int rc, vlan_id = 0; + + fiph = (struct fip_header *)skb->data; +@@ -2769,7 +2764,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe + goto drop; + } + +- rc = fcoe_ctlr_vn_parse(fip, skb, &buf.rdata); ++ rc = fcoe_ctlr_vn_parse(fip, skb, &frport); + if (rc) { + LIBFCOE_FIP_DBG(fip, "vn_recv vn_parse error %d\n", rc); + goto drop; +@@ -2778,19 +2773,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe + mutex_lock(&fip->ctlr_mutex); + switch (sub) { + case FIP_SC_VN_PROBE_REQ: +- fcoe_ctlr_vn_probe_req(fip, &buf.rdata); ++ fcoe_ctlr_vn_probe_req(fip, &frport.rdata); + break; + case FIP_SC_VN_PROBE_REP: +- fcoe_ctlr_vn_probe_reply(fip, &buf.rdata); ++ fcoe_ctlr_vn_probe_reply(fip, &frport.rdata); + break; + case FIP_SC_VN_CLAIM_NOTIFY: +- fcoe_ctlr_vn_claim_notify(fip, &buf.rdata); ++ fcoe_ctlr_vn_claim_notify(fip, &frport.rdata); + break; + case FIP_SC_VN_CLAIM_REP: +- fcoe_ctlr_vn_claim_resp(fip, &buf.rdata); ++ fcoe_ctlr_vn_claim_resp(fip, &frport.rdata); + break; + case FIP_SC_VN_BEACON: +- fcoe_ctlr_vn_beacon(fip, &buf.rdata); ++ fcoe_ctlr_vn_beacon(fip, &frport.rdata); + break; + default: + LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub); +@@ -2814,22 +2809,18 @@ drop: + */ + static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip, + struct sk_buff *skb, +- struct fc_rport_priv *rdata) ++ struct fcoe_rport *frport) + { + struct fip_header *fiph; + struct fip_desc *desc = NULL; + struct fip_mac_desc *macd = NULL; + struct fip_wwn_desc *wwn = NULL; +- struct fcoe_rport *frport; + size_t rlen; + size_t dlen; + u32 desc_mask = 0; + u32 dtype; + u8 sub; + +- memset(rdata, 0, sizeof(*rdata) + sizeof(*frport)); +- frport = fcoe_ctlr_rport(rdata); +- + fiph = (struct fip_header *)skb->data; + frport->flags = ntohs(fiph->fip_flags); + +@@ -2883,7 +2874,8 @@ static int fcoe_ctlr_vlan_parse(struct f + if (dlen != sizeof(struct fip_wwn_desc)) + goto len_err; + wwn = (struct fip_wwn_desc *)desc; +- rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); ++ frport->rdata.ids.node_name = ++ get_unaligned_be64(&wwn->fd_wwn); + break; + default: + LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x " +@@ -2994,22 +2986,19 @@ static int fcoe_ctlr_vlan_recv(struct fc + { + struct fip_header *fiph; + enum fip_vlan_subcode sub; +- struct { +- struct fc_rport_priv rdata; +- struct fcoe_rport frport; +- } buf; ++ struct fcoe_rport frport = { }; + int rc; + + fiph = (struct fip_header *)skb->data; + sub = fiph->fip_subcode; +- rc = fcoe_ctlr_vlan_parse(fip, skb, &buf.rdata); ++ rc = fcoe_ctlr_vlan_parse(fip, skb, &frport); + if (rc) { + LIBFCOE_FIP_DBG(fip, "vlan_recv vlan_parse error %d\n", rc); + goto drop; + } + mutex_lock(&fip->ctlr_mutex); + if (sub == FIP_SC_VL_REQ) +- fcoe_ctlr_vlan_disc_reply(fip, &buf.rdata); ++ fcoe_ctlr_vlan_disc_reply(fip, &frport.rdata); + mutex_unlock(&fip->ctlr_mutex); + + drop: +--- a/drivers/scsi/libfc/fc_rport.c ++++ b/drivers/scsi/libfc/fc_rport.c +@@ -140,6 +140,7 @@ EXPORT_SYMBOL(fc_rport_lookup); + struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) + { + struct fc_rport_priv *rdata; ++ size_t rport_priv_size = sizeof(*rdata); + + lockdep_assert_held(&lport->disc.disc_mutex); + +@@ -147,7 +148,9 @@ struct fc_rport_priv *fc_rport_create(st + if (rdata) + return rdata; + +- rdata = kzalloc(sizeof(*rdata) + lport->rport_priv_size, GFP_KERNEL); ++ if (lport->rport_priv_size > 0) ++ rport_priv_size = lport->rport_priv_size; ++ rdata = kzalloc(rport_priv_size, GFP_KERNEL); + if (!rdata) + return NULL; + +--- a/include/scsi/libfcoe.h ++++ b/include/scsi/libfcoe.h +@@ -241,6 +241,7 @@ struct fcoe_fcf { + * @vn_mac: VN_Node assigned MAC address for data + */ + struct fcoe_rport { ++ struct fc_rport_priv rdata; + unsigned long time; + u16 fcoe_len; + u16 flags;