From: Jon Mason <jon.mason@intel.com>
To: Jonghwan Choi <jhbird.choi@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonghwan Choi <jhbird.choi@samsung.com>
Subject: Re: [PATCH 3.9-stable] ntb: off by one sanity checks
Date: Sat, 18 May 2013 07:47:09 -0700 [thread overview]
Message-ID: <20130518144709.GA29066@jonmason-lab> (raw)
In-Reply-To: <1368844538-3841-1-git-send-email-jhbird.choi@samsung.com>
On Sat, May 18, 2013 at 11:35:38AM +0900, Jonghwan Choi wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
>
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?
Yes, please do. I'll respond to each of the patch series, but please
apply them all. Also, one patch was omitted from these, titled
NTB: variable dereferenced before check
Please include that patch in 3.9 stable as well.
Thank you for doing this.
Thanks,
Jon
>
> ------------------
>
> From: "Dan Carpenter <dan.carpenter@oracle.com>"
>
> commit ad3e2751e7c546ae678be1f8d86e898506b42cef upstream
>
> These tests are off by one. If "mw" is equal to NTB_NUM_MW then we
> would go beyond the end of the ndev->mw[] array.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jon Mason <jon.mason@intel.com>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
> drivers/ntb/ntb_hw.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index f802e7c..195cc51 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -345,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
> */
> void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
> {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
> return NULL;
>
> return ndev->mw[mw].vbase;
> @@ -362,7 +362,7 @@ void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
> */
> resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
> {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
> return 0;
>
> return ndev->mw[mw].bar_sz;
> @@ -380,7 +380,7 @@ resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
> */
> void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
> {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
> return;
>
> dev_dbg(&ndev->pdev->dev, "Writing addr %Lx to BAR %d\n", addr,
> --
> 1.8.1.2
>
next prev parent reply other threads:[~2013-05-18 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-18 2:35 [PATCH 3.9-stable] ntb: off by one sanity checks Jonghwan Choi
2013-05-18 14:47 ` Jon Mason [this message]
2013-05-20 16:38 ` Greg KH
2013-05-20 16:51 ` Jon Mason
2013-05-22 17:13 ` Greg KH
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=20130518144709.GA29066@jonmason-lab \
--to=jon.mason@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=jhbird.choi@gmail.com \
--cc=jhbird.choi@samsung.com \
--cc=linux-kernel@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 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.