Re: [PATCH 3.9-stable] ntb: off by one sanity checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 18, 2013 at 11:35:38AM +0900, Jonghwan Choi wrote:
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>"
> 
> 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@xxxxxxxxxx>
> Signed-off-by: Jon Mason <jon.mason@xxxxxxxxx>
> Signed-off-by: Jonghwan Choi <jhbird.choi@xxxxxxxxxxx>
> ---
>  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
> 
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]