From: Andrew Lunn <andrew@lunn•ch>
To: Linus Walleij <linus.walleij@linaro•org>
Cc: "Vivien Didelot" <vivien.didelot@savoirfairelinux•com>,
"Florian Fainelli" <f.fainelli@gmail•com>,
netdev@vger•kernel.org, openwrt-devel@lists•openwrt.org,
"LEDE Development List" <lede-dev@lists•infradead.org>,
"Antti Seppälä" <a.seppala@gmail•com>,
"Roman Yeryomin" <roman@advem•lv>,
"Colin Leitner" <colin.leitner@googlemail•com>,
"Gabor Juhos" <juhosg@openwrt•org>
Subject: Re: [PATCH 3/4 RFCv2] net: dsa: realtek-smi: Add Realtek SMI driver
Date: Mon, 28 May 2018 21:45:06 +0200 [thread overview]
Message-ID: <20180528194506.GF27177@lunn.ch> (raw)
In-Reply-To: <20180528174752.6806-4-linus.walleij@linaro.org>
> +struct rtl8366_mib_counter {
> + unsigned base;
> + unsigned offset;
> + unsigned length;
> + const char *name;
> +};
> +void rtl8366_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
> +{
> + struct realtek_smi *smi = ds->priv;
> + struct rtl8366_mib_counter *mib;
> + int i;
> +
> + if (port >= smi->num_ports)
> + return;
> +
> + for (i = 0; i < smi->num_mib_counters; i++) {
> + mib = &smi->mib_counters[i];
> + memcpy(data + i * ETH_GSTRING_LEN,
> + mib->name, ETH_GSTRING_LEN);
> + }
> +}
Hi Linus
name is a char *. Its length is determined by its content. But you
perform a memcpy of ETH_GSTRING_LEN. This can take you off the end of
the string causing an out of bounds error. Either make name
ETH_GSTRING_LEN long, or you strncpy().
Andrew
next prev parent reply other threads:[~2018-05-28 19:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 17:47 [PATCH 0/4 RFCv2] Realtek SMI RTL836x DSA driver Linus Walleij
2018-05-28 17:47 ` [PATCH 1/4 RFCv2] net: phy: realtek: Support RTL8366RB variant Linus Walleij
2018-05-29 12:34 ` Andrew Lunn
2018-05-29 18:51 ` [1/4,RFCv2] " Heiner Kallweit
2018-05-29 20:01 ` Linus Walleij
2018-05-29 20:17 ` Andrew Lunn
2018-05-29 21:15 ` Heiner Kallweit
2018-05-28 17:47 ` [PATCH 2/4 RFCv2] net: dsa: Add bindings for Realtek SMI DSAs Linus Walleij
2018-05-28 18:54 ` Andrew Lunn
2018-05-29 19:30 ` Florian Fainelli
2018-05-28 17:47 ` [PATCH 3/4 RFCv2] net: dsa: realtek-smi: Add Realtek SMI driver Linus Walleij
2018-05-28 19:33 ` Andrew Lunn
2018-05-28 19:45 ` Andrew Lunn [this message]
2018-05-28 17:47 ` [PATCH 4/4 RFCv2] ARM: dts: Add ethernet and switch to D-Link DIR-685 Linus Walleij
2018-05-28 18:20 ` [PATCH 0/4 RFCv2] Realtek SMI RTL836x DSA driver Andrew Lunn
2018-05-29 8:49 ` Linus Walleij
2018-05-29 12:24 ` Andrew Lunn
2018-05-29 18:41 ` Linus Walleij
2018-05-29 18:57 ` [OpenWrt-Devel] " Kevin Darbyshire-Bryant
2018-05-29 19:47 ` Linus Walleij
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=20180528194506.GF27177@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=a.seppala@gmail$(echo .)com \
--cc=colin.leitner@googlemail$(echo .)com \
--cc=f.fainelli@gmail$(echo .)com \
--cc=juhosg@openwrt$(echo .)org \
--cc=lede-dev@lists$(echo .)infradead.org \
--cc=linus.walleij@linaro$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=openwrt-devel@lists$(echo .)openwrt.org \
--cc=roman@advem$(echo .)lv \
--cc=vivien.didelot@savoirfairelinux$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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