summaryrefslogtreecommitdiff
path: root/drivers/net/can/dev.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-01-21 09:08:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-03 23:16:17 +0100
commitee607baae70b012cc3e5efe7520ea0187ba4372c (patch)
tree33bfcd9d5026f0f121129e03d64d66731f3a2a81 /drivers/net/can/dev.c
parent9f1f71f1d4bdf2003780e40a20cf0dea5900a182 (diff)
can: dev: prevent potential information leak in can_fill_info()
[ Upstream commit b552766c872f5b0d90323b24e4c9e8fa67486dd5 ] The "bec" struct isn't necessarily always initialized. For example, the mcp251xfd_get_berr_counter() function doesn't initialize anything if the interface is down. Fixes: 52c793f24054 ("can: netlink support for bus-error reporting and counters") Link: https://lore.kernel.org/r/YAkaRdRJncsJO8Ve@mwanda Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r--drivers/net/can/dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 45f15ac6b101..1a79118b008b 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -987,7 +987,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
struct can_ctrlmode cm = {.flags = priv->ctrlmode};
- struct can_berr_counter bec;
+ struct can_berr_counter bec = { };
enum can_state state = priv->state;
if (priv->do_get_state)