{"id":808261,"url":"http://patchwork.ozlabs.org/api/patches/808261/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170831141815.28003-1-thomas@m3y3r.de/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170831141815.28003-1-thomas@m3y3r.de>","list_archive_url":null,"date":"2017-08-31T14:18:15","name":"ipv6: sr: Use ARRAY_SIZE macro","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"d7cd44ae6e5b9287cc862bc13e0b19f9afa9520b","submitter":{"id":10277,"url":"http://patchwork.ozlabs.org/api/people/10277/?format=json","name":"Thomas Meyer","email":"thomas@m3y3r.de"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170831141815.28003-1-thomas@m3y3r.de/mbox/","series":[{"id":839,"url":"http://patchwork.ozlabs.org/api/series/839/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=839","date":"2017-08-31T14:18:15","name":"ipv6: sr: Use ARRAY_SIZE macro","version":1,"mbox":"http://patchwork.ozlabs.org/series/839/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808261/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808261/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjkxw3GCBz9sD5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 00:18:44 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751549AbdHaOSb (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 10:18:31 -0400","from www17.your-server.de ([213.133.104.17]:36626 \"EHLO\n\twww17.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751285AbdHaOSa (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 10:18:30 -0400","from [95.222.27.135] (helo=localhost.localdomain)\n\tby www17.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.85_2)\n\t(envelope-from <thomas@m3y3r.de>)\n\tid 1dnQIe-0000P1-Fh; Thu, 31 Aug 2017 16:18:28 +0200"],"From":"Thomas Meyer <thomas@m3y3r.de>","To":"davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org","Cc":"Thomas Meyer <thomas@m3y3r.de>","Subject":"[PATCH] ipv6: sr: Use ARRAY_SIZE macro","Date":"Thu, 31 Aug 2017 16:18:15 +0200","Message-Id":"<20170831141815.28003-1-thomas@m3y3r.de>","X-Mailer":"git-send-email 2.11.0","X-Authenticated-Sender":"thomas@m3y3r.de","X-Virus-Scanned":"Clear (ClamAV 0.99.2/23746/Thu Aug 31 14:35:48 2017)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Grepping for \"sizeof\\(.+\\) / sizeof\\(\" found this as one of the first\ncandidates.\nMaybe a coccinelle can catch all of those.\n\nSigned-off-by: Thomas Meyer <thomas@m3y3r.de>\n---\n net/ipv6/seg6_hmac.c | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c\nindex f950cb53d5e3..33fb35cbfac1 100644\n--- a/net/ipv6/seg6_hmac.c\n+++ b/net/ipv6/seg6_hmac.c\n@@ -12,6 +12,7 @@\n  */\n \n #include <linux/errno.h>\n+#include <linux/kernel.h>\n #include <linux/types.h>\n #include <linux/socket.h>\n #include <linux/sockios.h>\n@@ -110,7 +111,7 @@ static struct seg6_hmac_algo *__hmac_get_algo(u8 alg_id)\n \tstruct seg6_hmac_algo *algo;\n \tint i, alg_count;\n \n-\talg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo);\n+\talg_count = ARRAY_SIZE(hmac_algos);\n \tfor (i = 0; i < alg_count; i++) {\n \t\talgo = &hmac_algos[i];\n \t\tif (algo->alg_id == alg_id)\n@@ -360,7 +361,7 @@ static int seg6_hmac_init_algo(void)\n \tstruct shash_desc *shash;\n \tint i, alg_count, cpu;\n \n-\talg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo);\n+\talg_count = ARRAY_SIZE(hmac_algos);\n \n \tfor (i = 0; i < alg_count; i++) {\n \t\tstruct crypto_shash **p_tfm;\n@@ -421,7 +422,7 @@ void seg6_hmac_exit(void)\n \tstruct seg6_hmac_algo *algo = NULL;\n \tint i, alg_count, cpu;\n \n-\talg_count = sizeof(hmac_algos) / sizeof(struct seg6_hmac_algo);\n+\talg_count = ARRAY_SIZE(hmac_algos);\n \tfor (i = 0; i < alg_count; i++) {\n \t\talgo = &hmac_algos[i];\n \t\tfor_each_possible_cpu(cpu) {\n","prefixes":[]}