提交 e4932db2 编写于 作者: K kbuild test robot 提交者: Caspar Zhang

net: fix array_size.cocci warnings

net/hookers/hookers.c:194:44-45: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

[ caspar: remove redundant parentheses ]

Fixes: 3c74cfbb ("net: kernel hookers service for toa module")
CC: George Zhang <georgezhang@linux.alibaba.com>
Signed-off-by: Nkbuild test robot <lkp@intel.com>
Reviewed-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 59748140
...@@ -191,7 +191,7 @@ inet6_stream_ops_getname_stub(struct socket *sock, ...@@ -191,7 +191,7 @@ inet6_stream_ops_getname_stub(struct socket *sock,
return __getname_hstub(&place_table[4], sock, uaddr, peer); return __getname_hstub(&place_table[4], sock, uaddr, peer);
} }
#define PLACE_TABLE_SZ (sizeof((place_table)) / sizeof((place_table)[0])) #define PLACE_TABLE_SZ ARRAY_SIZE(place_table)
int hooker_install(const void *place, struct hooker *h) int hooker_install(const void *place, struct hooker *h)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册