diff mbox

netfilter: nft_redir: fix sparse warnings: cast to restricted __be32

Message ID 20141112111039.323.26439.stgit@nfdev.cica.es
State Not Applicable
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero Nov. 12, 2014, 11:10 a.m. UTC
This patch fixes some sparse warnings:

net/netfilter/nft_redir.c:39:26: sparse: incorrect type in assignment (different base types)
net/netfilter/nft_redir.c:39:26:    expected unsigned int [unsigned] [usertype] nla_be32
net/netfilter/nft_redir.c:39:26:    got restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:46:34: sparse: incorrect type in assignment (different base types)
net/netfilter/nft_redir.c:46:34:    expected unsigned int [unsigned] [usertype] nla_be32
net/netfilter/nft_redir.c:46:34:    got restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 net/netfilter/nft_redir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso Nov. 12, 2014, 11:56 a.m. UTC | #1
On Wed, Nov 12, 2014 at 12:10:39PM +0100, Arturo Borrero Gonzalez wrote:
> This patch fixes some sparse warnings:
> 
> net/netfilter/nft_redir.c:39:26: sparse: incorrect type in assignment (different base types)
> net/netfilter/nft_redir.c:39:26:    expected unsigned int [unsigned] [usertype] nla_be32
> net/netfilter/nft_redir.c:39:26:    got restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:46:34: sparse: incorrect type in assignment (different base types)
> net/netfilter/nft_redir.c:46:34:    expected unsigned int [unsigned] [usertype] nla_be32
> net/netfilter/nft_redir.c:46:34:    got restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
>  net/netfilter/nft_redir.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nft_redir.c b/net/netfilter/nft_redir.c
> index e27b4e3..dd2aa78 100644
> --- a/net/netfilter/nft_redir.c
> +++ b/net/netfilter/nft_redir.c
> @@ -28,7 +28,7 @@ int nft_redir_init(const struct nft_ctx *ctx,
>  		   const struct nlattr * const tb[])
>  {
>  	struct nft_redir *priv = nft_expr_priv(expr);
> -	u32 nla_be32;
> +	__be32 nla_be32;

Thanks Arturo.

I already sent a patch, I prefer to get rid of this variable for
consistency with other nft nat-like expressions.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arturo Borrero Nov. 12, 2014, 12:01 p.m. UTC | #2
On 12 November 2014 12:56, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> Thanks Arturo.
>
> I already sent a patch, I prefer to get rid of this variable for
> consistency with other nft nat-like expressions.

Sure, I just wasn't aware of your patch when sending mine.
diff mbox

Patch

diff --git a/net/netfilter/nft_redir.c b/net/netfilter/nft_redir.c
index e27b4e3..dd2aa78 100644
--- a/net/netfilter/nft_redir.c
+++ b/net/netfilter/nft_redir.c
@@ -28,7 +28,7 @@  int nft_redir_init(const struct nft_ctx *ctx,
 		   const struct nlattr * const tb[])
 {
 	struct nft_redir *priv = nft_expr_priv(expr);
-	u32 nla_be32;
+	__be32 nla_be32;
 	int err;
 
 	err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT);