Commit 6391c4f6 authored by Thomas Meyer's avatar Thomas Meyer Committed by David S. Miller

ipv6: sr: Use ARRAY_SIZE macro

Grepping for "sizeof\(.+\) / sizeof\(" found this as one of the first
candidates.
Maybe a coccinelle can catch all of those.
Signed-off-by: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5debc53f
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/sockios.h> #include <linux/sockios.h>
...@@ -110,7 +111,7 @@ static struct seg6_hmac_algo *__hmac_get_algo(u8 alg_id) ...@@ -110,7 +111,7 @@ static struct seg6_hmac_algo *__hmac_get_algo(u8 alg_id)
struct seg6_hmac_algo *algo; struct seg6_hmac_algo *algo;
int i, alg_count; int i, alg_count;
alg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo); alg_count = ARRAY_SIZE(hmac_algos);
for (i = 0; i < alg_count; i++) { for (i = 0; i < alg_count; i++) {
algo = &hmac_algos[i]; algo = &hmac_algos[i];
if (algo->alg_id == alg_id) if (algo->alg_id == alg_id)
...@@ -360,7 +361,7 @@ static int seg6_hmac_init_algo(void) ...@@ -360,7 +361,7 @@ static int seg6_hmac_init_algo(void)
struct shash_desc *shash; struct shash_desc *shash;
int i, alg_count, cpu; int i, alg_count, cpu;
alg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo); alg_count = ARRAY_SIZE(hmac_algos);
for (i = 0; i < alg_count; i++) { for (i = 0; i < alg_count; i++) {
struct crypto_shash **p_tfm; struct crypto_shash **p_tfm;
...@@ -421,7 +422,7 @@ void seg6_hmac_exit(void) ...@@ -421,7 +422,7 @@ void seg6_hmac_exit(void)
struct seg6_hmac_algo *algo = NULL; struct seg6_hmac_algo *algo = NULL;
int i, alg_count, cpu; int i, alg_count, cpu;
alg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo); alg_count = ARRAY_SIZE(hmac_algos);
for (i = 0; i < alg_count; i++) { for (i = 0; i < alg_count; i++) {
algo = &hmac_algos[i]; algo = &hmac_algos[i];
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment