Re: [PATCH] netfilter: nft_meta: Extend support for NFT_META_TSTAMP_NS

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

 



Hi Karuna,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Karuna-Grewal/netfilter-nft_meta-Extend-support-for-NFT_META_TSTAMP_NS/20190301-182752
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

smatch warnings:
net/netfilter/nft_meta.c:261 nft_meta_get_eval() warn: right shifting more than type allows 32 vs 32

# https://github.com/0day-ci/linux/commit/02c5bd91b2cb1485eeb226b93c885aaa3f7a2a39
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 02c5bd91b2cb1485eeb226b93c885aaa3f7a2a39
vim +261 net/netfilter/nft_meta.c

0fb4d2195 wenxu             2019-01-16  247  	case NFT_META_IIFKIND:
0fb4d2195 wenxu             2019-01-16  248  		if (in == NULL || in->rtnl_link_ops == NULL)
0fb4d2195 wenxu             2019-01-16  249  			goto err;
0fb4d2195 wenxu             2019-01-16  250  		strncpy((char *)dest, in->rtnl_link_ops->kind, IFNAMSIZ);
0fb4d2195 wenxu             2019-01-16  251  		break;
0fb4d2195 wenxu             2019-01-16  252  	case NFT_META_OIFKIND:
0fb4d2195 wenxu             2019-01-16  253  		if (out == NULL || out->rtnl_link_ops == NULL)
0fb4d2195 wenxu             2019-01-16  254  			goto err;
0fb4d2195 wenxu             2019-01-16  255  		strncpy((char *)dest, out->rtnl_link_ops->kind, IFNAMSIZ);
0fb4d2195 wenxu             2019-01-16  256  		break;
02c5bd91b Karuna Grewal     2019-03-01  257  	case NFT_META_TSTAMP_NS:
02c5bd91b Karuna Grewal     2019-03-01  258  		if (skb->tstamp == 0)
02c5bd91b Karuna Grewal     2019-03-01  259  			__net_timestamp((struct sk_buff *)skb);
02c5bd91b Karuna Grewal     2019-03-01  260  		u64 timestamp = ktime_to_ns(skb->tstamp);
02c5bd91b Karuna Grewal     2019-03-01 @261  		*dest = (u32) timestamp >> 32;
                                                                ^^^^^^^^^^^^^^^
Missing parentheses.  Generally, kernel style is to not put a space
after a cast, because casting is a high precedence operation.

02c5bd91b Karuna Grewal     2019-03-01  262  		*(dest + 1) = (u32) timestamp;
02c5bd91b Karuna Grewal     2019-03-01  263  		break;
96518518c Patrick McHardy   2013-10-14  264  	default:
96518518c Patrick McHardy   2013-10-14  265  		WARN_ON(1);
96518518c Patrick McHardy   2013-10-14  266  		goto err;
96518518c Patrick McHardy   2013-10-14  267  	}
96518518c Patrick McHardy   2013-10-14  268  	return;
96518518c Patrick McHardy   2013-10-14  269  
96518518c Patrick McHardy   2013-10-14  270  err:
a55e22e92 Patrick McHardy   2015-04-11  271  	regs->verdict.code = NFT_BREAK;
96518518c Patrick McHardy   2013-10-14  272  }
96518518c Patrick McHardy   2013-10-14  273  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux