[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Feb 2018 16:59:18 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Arnd Bergmann' <arnd@...db.de>,
Ganesh Goudar <ganeshgr@...lsio.com>
CC: Nicolas Pitre <nico@...aro.org>, Andi Kleen <ak@...ux.intel.com>,
"David S. Miller" <davem@...emloft.net>,
Herbert Xu <herbert@...dor.apana.org.au>,
Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>,
Kumar Sanghvi <kumaras@...lsio.com>,
Harsh Jain <harsh@...lsio.com>,
Atul Gupta <atul.gupta@...lsio.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net: cxgb4: avoid memcpy beyond end of source buffer
From: Arnd Bergmann
> Sent: 02 February 2018 15:19
>
> Building with link-time-optimizations revealed that the cxgb4 driver does
> a fixed-size memcpy() from a variable-length constant string into the
> network interface name:
...
> I can see two equally workable solutions: either we use a strncpy() instead
> of the memcpy() to stop at the end of the input, or we make the source buffer
> fixed length as well. This implements the latter.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
> index 1d37672902da..a14e8db51cdc 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
> @@ -355,7 +355,7 @@ struct cxgb4_lld_info {
> };
>
> struct cxgb4_uld_info {
> - const char *name;
> + char name[IFNAMSIZ];
> void *handle;
> unsigned int nrxq;
> unsigned int rxq_size;
> --
> 2.9.0
Surely there is another part to this patch?
David
Powered by blists - more mailing lists