From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: harish.patil@cavium.com, manish.chopra@cavium.com,
Dept-GELinuxNICDev@cavium.com, stable@vger.kernel.org,
keescook@chromium.org, gustavo@embeddedor.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [net-next] qlge: avoid memcpy buffer overflow
Date: Thu, 24 Aug 2017 14:01:37 -0700 (PDT) [thread overview]
Message-ID: <20170824.140137.2014331371813442270.davem@davemloft.net> (raw)
In-Reply-To: <20170823135958.1379527-1-arnd@arndb.de>
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 23 Aug 2017 15:59:49 +0200
> gcc-8.0.0 (snapshot) points out that we copy a variable-length string
> into a fixed length field using memcpy() with the destination length,
> and that ends up copying whatever follows the string:
>
> inlined from 'ql_core_dump' at drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:1106:2:
> drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:708:2: error: 'memcpy' reading 15 bytes from a region of size 14 [-Werror=stringop-overflow=]
> memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
>
> Changing it to use strncpy() will instead zero-pad the destination,
> which seems to be the right thing to do here.
>
> The bug is probably harmless, but it seems like a good idea to address
> it in stable kernels as well, if only for the purpose of building with
> gcc-8 without warnings.
>
> Cc: stable@vger.kernel.org
Please don't use explicit stable CC:'ing for networking changes.
> Fixes: a61f80261306 ("qlge: Add ethtool register dump function.")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied to 'net' and queued up for -stable, thanks.
prev parent reply other threads:[~2017-08-24 21:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 13:59 [PATCH] [net-next] qlge: avoid memcpy buffer overflow Arnd Bergmann
2017-08-24 21:01 ` David Miller [this message]
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=20170824.140137.2014331371813442270.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Dept-GELinuxNICDev@cavium.com \
--cc=arnd@arndb.de \
--cc=gustavo@embeddedor.com \
--cc=harish.patil@cavium.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manish.chopra@cavium.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).