]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map
authorColin Ian King <colin.king@canonical.com>
Sun, 7 Jan 2018 23:45:08 +0000 (23:45 +0000)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 9 Mar 2018 00:25:00 +0000 (16:25 -0800)
Orabug: 27615319

Use the ARRAY_SIZE macro on array cmd_priv_map to determine size of the
array.  Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Reviewed-by: Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/emulex/benet/be_cmds.c

index 8027ccc42e2b55472e54d0ac34912f98ddc65cf2..33ae32edbcea6aabf6e29adeff426841a9a96e1b 100644 (file)
@@ -103,7 +103,7 @@ static struct be_cmd_priv_map cmd_priv_map[] = {
 static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, u8 subsystem)
 {
        int i;
-       int num_entries = sizeof(cmd_priv_map)/sizeof(struct be_cmd_priv_map);
+       int num_entries = ARRAY_SIZE(cmd_priv_map);
        u32 cmd_privileges = adapter->cmd_privileges;
 
        for (i = 0; i < num_entries; i++)