LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sebastian Kuzminsky <seb.kuzminsky@gmail.com>
To: "Kalluru, Sudarsana" <Sudarsana.Kalluru@cavium.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Elior, Ariel" <Ariel.Elior@cavium.com>,
Dept-Eng Everest Linux L2 <Dept-EngEverestLinuxL2@cavium.com>
Subject: Re: fix for bnx2x panic during ethtool reporting
Date: Tue, 24 Apr 2018 11:22:37 -0600 [thread overview]
Message-ID: <CAOTh5U0MViVUN1a59Q3ciebyiYCw==OgiTSeB5nuPJT+Y-Dm+g@mail.gmail.com> (raw)
In-Reply-To: <MW2PR07MB4139D11DC60825A8A6C04E068A880@MW2PR07MB4139.namprd07.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 126 bytes --]
Here's an updated version of the patch that is checkpatch.pl clean (I
had forgotten to sign off...).
--
Sebastian Kuzminsky
[-- Attachment #2: 0001-bnx2x-make-fw-str-in-a-non-crazy-way.patch --]
[-- Type: text/x-patch, Size: 1290 bytes --]
From 45fe6fb1f6a187233bd1304b031bed20b3819d26 Mon Sep 17 00:00:00 2001
From: Sebastian Kuzminsky <seb@highlab.com>
Date: Mon, 16 Apr 2018 23:24:07 +0000
Subject: [PATCH] bnx2x: make fw str in a non-crazy way
This fixes an unterminated string bug when the firwmare version
(bp->fw_ver) is longer than the passed-in buffer (buf/buf_len).
Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 6465414dad74..f023ee365c63 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -150,9 +150,9 @@ void bnx2x_fill_fw_str(struct bnx2x *bp, char *buf, size_t buf_len)
phy_fw_ver[0] = '\0';
bnx2x_get_ext_phy_fw_version(&bp->link_params,
phy_fw_ver, PHY_FW_VER_LEN);
- strlcpy(buf, bp->fw_ver, buf_len);
- snprintf(buf + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver),
- "bc %d.%d.%d%s%s",
+ snprintf(buf, buf_len,
+ "%s bc %d.%d.%d%s%s",
+ bp->fw_ver,
(bp->common.bc_ver & 0xff0000) >> 16,
(bp->common.bc_ver & 0xff00) >> 8,
(bp->common.bc_ver & 0xff),
--
2.11.0
prev parent reply other threads:[~2018-04-24 17:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 17:21 Sebastian Kuzminsky
2018-04-17 23:42 ` Florian Fainelli
2018-04-24 11:23 ` Kalluru, Sudarsana
2018-04-24 17:22 ` Sebastian Kuzminsky [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='CAOTh5U0MViVUN1a59Q3ciebyiYCw==OgiTSeB5nuPJT+Y-Dm+g@mail.gmail.com' \
--to=seb.kuzminsky@gmail.com \
--cc=Ariel.Elior@cavium.com \
--cc=Dept-EngEverestLinuxL2@cavium.com \
--cc=Sudarsana.Kalluru@cavium.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--subject='Re: fix for bnx2x panic during ethtool reporting' \
/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
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).