[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202105281129.530BBAF694@keescook>
Date: Fri, 28 May 2021 11:29:59 -0700
From: Kees Cook <keescook@...omium.org>
To: Joe Perches <joe@...ches.com>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
Hannes Reinecke <hare@...e.de>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Bradley Grove <linuxdrivers@...otech.com>,
Artur Paszkiewicz <artur.paszkiewicz@...el.com>,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH 1/3] scsi: fcoe: Statically initialize flogi_maddr
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:
> > 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.
> []
> > diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
> []
> > @@ -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
>
> > @@ -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
Powered by blists - more mailing lists