From patchwork Thu Apr 20 17:12:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 9691017 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57B0260326 for ; Thu, 20 Apr 2017 17:13:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 497D120265 for ; Thu, 20 Apr 2017 17:13:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E3CC284D6; Thu, 20 Apr 2017 17:13:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3869920265 for ; Thu, 20 Apr 2017 17:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033487AbdDTRNX (ORCPT ); Thu, 20 Apr 2017 13:13:23 -0400 Received: from mga05.intel.com ([192.55.52.43]:17290 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S946110AbdDTRNT (ORCPT ); Thu, 20 Apr 2017 13:13:19 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 20 Apr 2017 10:13:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,225,1488873600"; d="scan'208";a="1158856142" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by fmsmga002.fm.intel.com with ESMTP; 20 Apr 2017 10:13:13 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1d1Ffh-000U55-SI; Fri, 21 Apr 2017 01:15:09 +0800 Date: Fri, 21 Apr 2017 01:12:40 +0800 From: kbuild test robot To: Gilad Ben-Yossef Cc: kbuild-all@01.org, Herbert Xu , "David S. Miller" , Rob Herring , Mark Rutland , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, gilad.benyossef@arm.com, Binoy Jayan , Ofir Drang , Stuart Yoder Subject: [PATCH] staging: ccree: fix array_size.cocci warnings Message-ID: <20170420171240.GA8694@lkp-ne04.lkp.intel.com> References: <201704210005.6d09webv%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1492693983-8175-2-git-send-email-gilad@benyossef.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Fengguang Wu --- 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; }