Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp14521436rwd; Sat, 24 Jun 2023 22:30:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fZbRdnEJyj3/3lJSDHLrlESTboI3kLAwRlRrP92zBlpsXjFcRWV8cO1gFK3b/TbVfGd52 X-Received: by 2002:a05:6a20:4428:b0:125:4d74:cd7c with SMTP id ce40-20020a056a20442800b001254d74cd7cmr10562533pzb.44.1687671030449; Sat, 24 Jun 2023 22:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687671030; cv=none; d=google.com; s=arc-20160816; b=MhybSfb7pwN4+gFbpITi9Xht4ckaL2ssfoi3AsXCElnZhnr1TmUvRUrIIy4uDAd2Zf 8I6JnMh0DIWMj5c7vi87kFu35ublxzAGahtAccHrEGSZTwkKcpg2tuVTjVoTyZ9n1nVj rDqouPdOKcULlARKtLqZmUM2FhVRoGug9BBSOI3PjmYVUJ7AJcC+bWDI4gw0oFXP9MGw yVrIEgCOfvXMUKXapkI6ECCsjuqCM6hKgkn5BqCWQF1dYEC7U2RDGo+dPYqQx4VlDF8f hMN1yN5ibLxfknTKqKgzj+e9BXNUXe+EXREV/jKpUlV5zVG23zNmPKg+K+S5/DmPw8So k6JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=5Cv9zU0GWem03nbxbnMecJ3Wv5+ZRchEp0Y7Rp7XppU=; fh=8HfjV56bkpJ/eFvbe3U7BpNMRmHm54jweFeZxoarsVM=; b=rcH0ON/ahFKnjqgwSYdq6JUgFyivqBtAX+3yNQHckF4FFw0S7xNKUAK08wgy7xhEbE AyY9e0/m33eoQIUdAnldf0N3PEs6yAeE08243mWfcMakewKId7kcZwecw0rXee5utI7+ FreLEur2vOM64NvHzJ61BRhrtG8/+qici2NlUY36oLgxdaY2Q2Akpqjm3doHKHM0/5eS /pbCi/VzeowT/tQPpelpOSHCF09UIECo+OSZcaGlw59FqlRAimgd/j2V9G/YNd1so4Qw HTShgvikvo4ufq2wBFfNa/xioz6jrn09UoRIn1FWZuxBc8Ff4am1bC+2tXmfdgVLYUYu 9XwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bjMCC3WH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n125-20020a634083000000b0054fe7642adesi2628607pga.790.2023.06.24.22.30.09; Sat, 24 Jun 2023 22:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bjMCC3WH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjFYFBi (ORCPT + 99 others); Sun, 25 Jun 2023 01:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbjFYFBe (ORCPT ); Sun, 25 Jun 2023 01:01:34 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FA7E65; Sat, 24 Jun 2023 22:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687669292; x=1719205292; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=KdNqYETF+XtrRZPtYEeWQrXvPosc/lvpXCnD1OhovGE=; b=bjMCC3WHIr+FKqpfH9nmBK773oj0q8pXmBQk2+iCQFu/+n2AHPXrrGRt NR6f35aIhM+8vcdkgWVHn4LV02BiLk9dBflaCRF+mM3MsrjTypwcV5SWO vj96Aqsq/XXdOkSthwV+pCudyV/a692XogUI+cfcCTW0YFUrK+viUVgfM x/ZscTeGA7iqXCXBFjDsPrXPMrXJgnvj5Eluf8067ie5MCmBvfyvS0GjY uzSXH20spzR8PjOlfCksGluUZZCfVR107q5ARL2z5V4+4N3v2jMqR2gL0 fjw8r05TruBnzU7Qu9fUtFPYrCK7pWj6W/5w/aePaoxAgiM8g3IiCNtoP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10751"; a="427015420" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="427015420" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2023 22:01:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10751"; a="693087965" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="693087965" Received: from ipu5-build.bj.intel.com (HELO [10.238.232.139]) ([10.238.232.139]) by orsmga006.jf.intel.com with ESMTP; 24 Jun 2023 22:01:24 -0700 Subject: Re: [PATCH 23/26] media: staging: imgu: use array_size To: Julia Lawall , Sakari Ailus Cc: keescook@chromium.org, kernel-janitors@vger.kernel.org, Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Greg Kroah-Hartman , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20230623211457.102544-1-Julia.Lawall@inria.fr> <20230623211457.102544-24-Julia.Lawall@inria.fr> From: Bingbu Cao Message-ID: <778fdf52-9e87-cacd-94a3-cd42554587c5@linux.intel.com> Date: Sun, 25 Jun 2023 12:59:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20230623211457.102544-24-Julia.Lawall@inria.fr> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Julia, Thanks for your patch. On 6/24/23 5:14 AM, Julia Lawall wrote: > Use array_size to protect against multiplication overflows. > > The changes were done using the following Coccinelle semantic patch: > > // > @@ > expression E1, E2; > constant C1, C2; > identifier alloc = {vmalloc,vzalloc}; > @@ > > ( > alloc(C1 * C2,...) > | > alloc( > - (E1) * (E2) > + array_size(E1, E2) > ,...) > ) > // > > Signed-off-by: Julia Lawall > > --- > drivers/staging/media/ipu3/ipu3-mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/ipu3/ipu3-mmu.c b/drivers/staging/media/ipu3/ipu3-mmu.c > index cb9bf5fb29a5..9c4adb815c94 100644 > --- a/drivers/staging/media/ipu3/ipu3-mmu.c > +++ b/drivers/staging/media/ipu3/ipu3-mmu.c > @@ -464,7 +464,7 @@ struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base) > * Allocate the array of L2PT CPU pointers, initialized to zero, > * which means the dummy L2PT allocated above. > */ > - mmu->l2pts = vzalloc(IPU3_PT_PTES * sizeof(*mmu->l2pts)); > + mmu->l2pts = vzalloc(array_size(IPU3_PT_PTES, sizeof(*mmu->l2pts))); > if (!mmu->l2pts) > goto fail_l2pt; > > Reviewed-by: Bingbu Cao -- Best regards, Bingbu Cao