From e4932db2d29c1557a0660ee583b93b3318256152 Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Thu, 23 May 2019 14:19:29 +0800 Subject: [PATCH] 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: 3c74cfbb24b8 ("net: kernel hookers service for toa module") CC: George Zhang Signed-off-by: kbuild test robot Reviewed-by: Caspar Zhang --- net/hookers/hookers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/hookers/hookers.c b/net/hookers/hookers.c index c753789d568c..4791f307b4c9 100644 --- a/net/hookers/hookers.c +++ b/net/hookers/hookers.c @@ -191,7 +191,7 @@ inet6_stream_ops_getname_stub(struct socket *sock, 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) { -- GitLab