Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627689
| Path | csiph.com!goblin1!goblin.stu.neva.ru!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | kbuild test robot <lkp@intel.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] staging: ccree: fix array_size.cocci warnings |
| Date | Thu, 20 Apr 2017 19:20:01 +0200 |
| Message-ID | <tynUl-3h3-7@gated-at.bofh.it> (permalink) |
| References | <tynUl-3h3-1@gated-at.bofh.it> <tyka6-XM-27@gated-at.bofh.it> |
| X-Original-To | Gilad Ben-Yossef <gilad@benyossef.com> |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.37,225,1488873600"; d="scan'208";a="1158856142" |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| X-Sa-Exim-Connect-IP | <locally generated> |
| X-Sa-Exim-Mail-From | fengguang.wu@intel.com |
| X-Sa-Exim-Scanned | No (on bee); SAEximRunCond expanded to false |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 41 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | kbuild-all@01.org, Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, devel@driverdev.osuosl.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, gilad.benyossef@arm.com, Binoy Jayan <binoy.jayan@linaro.org>, Ofir Drang <ofir.drang@arm.com>, Stuart Yoder <stuart.yoder@arm.com> |
| X-Original-Date | Fri, 21 Apr 2017 01:12:40 +0800 |
| X-Original-Message-ID | <20170420171240.GA8694@lkp-ne04.lkp.intel.com> |
| X-Original-References | <201704210005.6d09webv%fengguang.wu@intel.com> <1492693983-8175-2-git-send-email-gilad@benyossef.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1627689 |
Show key headers only | View raw
drivers/staging/ccree/ssi_sysfs.c:319:34-35: WARNING: Use ARRAY_SIZE
drivers/staging/ccree/ssi_sysfs.c:429:34-35: 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
CC: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
ssi_sysfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -316,7 +316,7 @@ static ssize_t ssi_sys_help_show(struct
int i=0, offset = 0;
offset += scnprintf(buf + offset, PAGE_SIZE - offset, "Usage:\n");
- for ( i = 0; i < (sizeof(help_str)/sizeof(help_str[0])); i+=2) {
+ for ( i = 0; i < ARRAY_SIZE(help_str); i+=2) {
offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", help_str[i], help_str[i+1]);
}
return offset;
@@ -426,8 +426,7 @@ int ssi_sysfs_init(struct kobject *sys_d
/* Initialize top directory */
retval = sys_init_dir(&sys_top_dir, drvdata, sys_dev_obj,
"cc_info", ssi_sys_top_level_attrs,
- sizeof(ssi_sys_top_level_attrs) /
- sizeof(struct kobj_attribute));
+ ARRAY_SIZE(ssi_sys_top_level_attrs));
return retval;
}
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] staging: ccree: fix array_size.cocci warnings kbuild test robot <lkp@intel.com> - 2017-04-20 19:20 +0200
csiph-web