From: Dan Carpenter <dan.carpenter@oracle.com> To: Xue Liu <liuxuenetmail@gmail.com> Cc: Alexander Aring <alex.aring@gmail.com>, Stefan Schmidt <stefan@datenfreihafen.org>, "David S. Miller" <davem@davemloft.net>, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] ieee802154: mcr20a: read out of bounds in mcr20a_set_channel() Date: Wed, 29 Aug 2018 17:49:23 +0300 [thread overview] Message-ID: <20180829144923.6p2omsbe2s343wea@kili.mountain> (raw) The "channel" variable can be any u8 value. We need to make sure we don't read outside of the PLL_INT[] or PLL_FRAC[] arrays. Fixes: 8c6ad9cc5157 ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- This patch is obviously harmless, but it's from static analysis. I'm pretty sure this is required, but I can't swear. diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index e428277781ac..4f41d1d3588e 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c @@ -512,6 +512,9 @@ mcr20a_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel) dev_dbg(printdev(lp), "%s\n", __func__); + if (channel < 11 || channel - 11 >= ARRAY_SIZE(PLL_INT)) + return -EINVAL; + /* freqency = ((PLL_INT+64) + (PLL_FRAC/65536)) * 32 MHz */ ret = regmap_write(lp->regmap_dar, DAR_PLL_INT0, PLL_INT[channel - 11]); if (ret)
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Xue Liu <liuxuenetmail@gmail.com> Cc: Alexander Aring <alex.aring@gmail.com>, Stefan Schmidt <stefan@datenfreihafen.org>, "David S. Miller" <davem@davemloft.net>, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] ieee802154: mcr20a: read out of bounds in mcr20a_set_channel() Date: Wed, 29 Aug 2018 14:49:23 +0000 [thread overview] Message-ID: <20180829144923.6p2omsbe2s343wea@kili.mountain> (raw) The "channel" variable can be any u8 value. We need to make sure we don't read outside of the PLL_INT[] or PLL_FRAC[] arrays. Fixes: 8c6ad9cc5157 ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- This patch is obviously harmless, but it's from static analysis. I'm pretty sure this is required, but I can't swear. diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index e428277781ac..4f41d1d3588e 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c @@ -512,6 +512,9 @@ mcr20a_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel) dev_dbg(printdev(lp), "%s\n", __func__); + if (channel < 11 || channel - 11 >= ARRAY_SIZE(PLL_INT)) + return -EINVAL; + /* freqency = ((PLL_INT+64) + (PLL_FRAC/65536)) * 32 MHz */ ret = regmap_write(lp->regmap_dar, DAR_PLL_INT0, PLL_INT[channel - 11]); if (ret)
next reply other threads:[~2018-08-29 18:47 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-29 14:49 Dan Carpenter [this message] 2018-08-29 14:49 ` [PATCH] ieee802154: mcr20a: read out of bounds in mcr20a_set_channel() Dan Carpenter [not found] ` <CAJuUDwtjRi0HnR95uaFp4zviSC7Yrs68o8jsK1nY6jWu6909bg@mail.gmail.com> 2018-08-30 7:54 ` Dan Carpenter 2018-08-30 7:54 ` Dan Carpenter
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=20180829144923.6p2omsbe2s343wea@kili.mountain \ --to=dan.carpenter@oracle.com \ --cc=alex.aring@gmail.com \ --cc=davem@davemloft.net \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-wpan@vger.kernel.org \ --cc=liuxuenetmail@gmail.com \ --cc=netdev@vger.kernel.org \ --cc=stefan@datenfreihafen.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.