mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Arnd Bergmann'" <arnd@arndb.de>, Ganesh Goudar <ganeshgr@chelsio.com>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
	Kumar Sanghvi <kumaras@chelsio.com>,
	Harsh Jain <harsh@chelsio.com>,
	Atul Gupta <atul.gupta@chelsio.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] net: cxgb4: avoid memcpy beyond end of source buffer
Date: Fri, 2 Feb 2018 16:59:18 +0000	[thread overview]
Message-ID: <54678fa6afa247a98922409d5473053c@AcuMS.aculab.com> (raw)
In-Reply-To: <20180202151849.808610-1-arnd@arndb.de>

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@arndb.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

  reply	other threads:[~2018-02-02 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 15:18 Arnd Bergmann
2018-02-02 16:59 ` David Laight [this message]
2018-02-03  0:33 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54678fa6afa247a98922409d5473053c@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=ak@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=atul.gupta@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=ganeshgr@chelsio.com \
    --cc=harsh@chelsio.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kumaras@chelsio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@linaro.org \
    --cc=rahul.lakkireddy@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®