lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 05 Apr 2016 01:13:55 -0700
From:	Joe Perches <joe@...ches.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net
Cc:	Bruce Allan <bruce.w.allan@...el.com>, netdev@...r.kernel.org,
	nhorman@...hat.com, sassmann@...hat.com, jogreene@...hat.com
Subject: Re: [net-next 03/16] fm10k: Avoid crashing the kernel

On Tue, 2016-04-05 at 01:01 -0700, Jeff Kirsher wrote:
> From: Bruce Allan <bruce.w.allan@...el.com>
> 
> Use BUILD_BUG_ON() instead of BUG_ON() where appropriate to get a compile
> error rather than crash the kernel.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@...el.com>
> Acked-by: Alexander Duyck <aduyck@...antis.com>
> Tested-by: Krishneil Singh <Krishneil.k.singh@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> index 28837ae..6a9f988 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> @@ -398,7 +398,7 @@ static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i)
>  	buff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i));
>  	buff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i));
>  
> -	BUG_ON(idx != FM10K_REGS_LEN_Q);
> +	BUILD_BUG_ON(idx != FM10K_REGS_LEN_Q);

idx is a variable.
Does this work on all compilers?

>  }
>  
>  /* If function above adds more registers this define needs to be updated */
> @@ -414,7 +414,7 @@ static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i)
>  	for (j = 0; j < 32; j++)
>  		buff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j));
>  
> -	BUG_ON(idx != FM10K_REGS_LEN_VSI);
> +	BUILD_BUG_ON(idx != FM10K_REGS_LEN_VSI);
>  }
>  
>  static void fm10k_get_regs(struct net_device *netdev,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ