Thread (9 messages) 9 messages, 4 authors, 2021-06-08

Re: [PATCH 1/3] scsi: fcoe: Statically initialize flogi_maddr

From: Kees Cook <hidden>
Date: 2021-05-28 18:30:04
Also in: linux-hardening, lkml

On Fri, May 28, 2021 at 11:28:59AM -0700, Joe Perches wrote:
On Fri, 2021-05-28 at 11:13 -0700, Kees Cook wrote:
quoted
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy() using memcpy() with an inline const
buffer and instead just statically initialize the destination array
directly.
[]
quoted
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
[]
quoted
@@ -293,7 +293,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
 	struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
 	struct netdev_hw_addr *ha;
 	struct net_device *real_dev;
-	u8 flogi_maddr[ETH_ALEN];
+	u8 flogi_maddr[ETH_ALEN] = FC_FCOE_FLOGI_MAC;
static const
quoted
@@ -442,7 +441,7 @@ static void fcoe_interface_remove(struct fcoe_interface *fcoe)
 {
 	struct net_device *netdev = fcoe->netdev;
 	struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
-	u8 flogi_maddr[ETH_ALEN];
+	u8 flogi_maddr[ETH_ALEN] = FC_FCOE_FLOGI_MAC;
etc...
Hm, good point.

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help