Variable 'table' is an array of type struct table_struct, so this is a
classical use-case for ARRAY_SIZE() macro.

Signed-off-by: Phil Sutter <p...@nwl.cc>
---
 iptables/nft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index 89b1c7a808f57..3c230c121f8b9 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2888,7 +2888,7 @@ const char *nft_strerror(int err)
            { NULL, ENOENT, "No chain/target/match by that name" },
          };
 
-       for (i = 0; i < sizeof(table)/sizeof(struct table_struct); i++) {
+       for (i = 0; i < ARRAY_SIZE(table); i++) {
                if ((!table[i].fn || table[i].fn == nft_fn)
                    && table[i].err == err)
                        return table[i].message;
-- 
2.23.0

Reply via email to