From patchwork Thu Aug 25 15:50:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9299527 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 BBCD4607D8 for ; Thu, 25 Aug 2016 15:52:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACFF42938B for ; Thu, 25 Aug 2016 15:52:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A130F2938F; Thu, 25 Aug 2016 15:52:52 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F3782938B for ; Thu, 25 Aug 2016 15:52:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcww1-0004sN-C1; Thu, 25 Aug 2016 15:51:17 +0000 Received: from mout.web.de ([212.227.17.11]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcwvx-0004pj-La for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2016 15:51:14 +0000 Received: from [192.168.1.3] ([78.49.16.254]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M3k8j-1bLHPt1WU5-00rEmn; Thu, 25 Aug 2016 17:50:40 +0200 To: linux-arm-kernel@lists.infradead.org, Al Viro , Dave Weinstein , Jeff Layton , Kees Cook , Nicolas Pitre , Russell King From: SF Markus Elfring Subject: [PATCH] arm: sys_oabi-compat: Use kmalloc_array() in two functions Message-ID: <5deba521-2dd4-cd2e-23d7-226a1a7728c3@users.sourceforge.net> Date: Thu, 25 Aug 2016 17:50:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 X-Provags-ID: V03:K0:FavF8FKA7G5+s1VKewuckVst29TspgBVLwj3Olh9GiOOPYZ+/Bs uQsVfm+9WveeJv+0Pe3sj5+AzzHBnu/1UWcDwEG/aPuHR3FZQ2woy6uW64rUs5KAeqkssua qcIXXQP8bo4LPdaYYbp+wlt3KAFiNmsA/o+v6ra2nJW75TraFhsT07iZJql92bQpkhCI6qb Sw7EOHQguLmGh2fPoYfkg== X-UI-Out-Filterresults: notjunk:1; V01:K0:zQC8Rn6Iy00=:qY6iMnN874Bg7p8SKkFV8z kkGIRyqkoR+LbAVdMGB+ziUbs3KTSQQ+uxk9w40/gzFG3ETFa2kjn/vN0NElAkVqv+Bcy225r 5HGWZX6cpqABc91ySjABkBcFEiTAvmCO/+tvybpx/cR7C4GhpZ54LkISYBzr5T1n9FoZyilyr iOj75fT0/mFBHQeum1VDWCBU6YHoKeOig1hlVbMz8AnT8jCO4t7KFaaI0wNWCSQ4AkyG/Auyc rAzSGcb0M3g4VAL+5ieCnhXRR796akFn6MtEL3x7fVDpXQHXuFIUYccI5KDBxfDhdKk5TiQ7n fIWt6WPLKf60ikgfilFYc3zZ2IXwqf0lwDlh9uSC4/Jwp1ynHjh1mlJKwwcakLcM5FLvMX9Fo 8oqfpyeTmV6LkPok9pjUgRW+aPYHypc01tgN1WfMu0Z8dNi4J23OVtDRvkVMAWzmu8LxSii/h CaErGSt3D4Sb2cyILRXWV9UtgzP50HjWY5gHXKiCMvHi4Q38pY/Yei1fbL0mGH1xCHaHEEjfQ J4K61BU2FOf2c4xGAfGnzLT2e3tkkay/DWf9cXrAiGodslvSgB2zj817WGmXiXIzl+dKD63U8 45uj7vgijA0eEEjE0ruu3LDoaUv0u9QLZ3Dc523IJj/dSCJ9/Ra7lOjbCpyWXVEr95ML1DtFN 382zHQPOOAvI5PModAqjVrTbYfmFnMnWaPWRXbGkan6ksA89i+zqRnNsVExoyQU3tFSYcWPXo 0lOkkQJ2hUvmgjU/jrxxhyqbqZuxG7C/lkTKukQj/kHs1ChY0COuTkeI/mtlBrFO1G40AhJ3+ a7tnJKNfIiJU+nLd5ic4YSc60EZ0g== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160825_085114_114396_147C899F X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML , Paolo Bonzini Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 25 Aug 2016 17:45:23 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Acked-by: Nicolas Pitre --- arch/arm/kernel/sys_oabi-compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c index 5f221ac..e624db9 100644 --- a/arch/arm/kernel/sys_oabi-compat.c +++ b/arch/arm/kernel/sys_oabi-compat.c @@ -285,7 +285,7 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, return -EINVAL; if (!access_ok(VERIFY_WRITE, events, sizeof(*events) * maxevents)) return -EFAULT; - kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL); + kbuf = kmalloc_array(maxevents, sizeof(*kbuf), GFP_KERNEL); if (!kbuf) return -ENOMEM; fs = get_fs(); @@ -323,7 +323,7 @@ asmlinkage long sys_oabi_semtimedop(int semid, return -EINVAL; if (!access_ok(VERIFY_READ, tsops, sizeof(*tsops) * nsops)) return -EFAULT; - sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); + sops = kmalloc_array(nsops, sizeof(*sops), GFP_KERNEL); if (!sops) return -ENOMEM; err = 0;