Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17876727rwd; Tue, 27 Jun 2023 08:36:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7l142W9wkjoH8Y16I3LVE0PhxzixPwUMsMoc+DaMOSz6PpthIbQ1OMMxQQuZJnW5OmM7dA X-Received: by 2002:a17:902:d48c:b0:1b7:e49f:3b with SMTP id c12-20020a170902d48c00b001b7e49f003bmr11330234plg.45.1687880184600; Tue, 27 Jun 2023 08:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687880184; cv=none; d=google.com; s=arc-20160816; b=E5/Xtr0EXFNkHQ870AJu80YmB20ZrTJT59upQw7wue7TshUHQVympLkkI/MmDGhAd2 2vrh8g7xSDLDErV3HFdBPQCNq20AAL0H3XtyMtDr5QbSBcbLyXioPYu79gjj2wHbf+++ eTdFuXJ40VJiI9f1jf70g2pe2T7GNZXNKejSMvQhWhQsvJuacPeyjkiJeowdw5blB7W1 4QEwZNuVfvXPinfSmF/djxNhOu1BeLoVvzBl0zja6OS+DXwPWN6s/CfccCtMutMDkHpz iOLOZab67rOFxgveid3ozi0p0p+My/powqqtYCTBrYIBPown6LVmnh6CGdfk0dnv81jQ yqzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hFqgsytwO7YkPhtAzxumxYOYePgrq4GqYMK6wBUKkqU=; fh=rOD06bZo4Pqlf5nzq0N06Wmll6ssMyFnMlyDbBErXys=; b=Y2bcc0X8EDGIqOyBxlbbkhUqBYyQGHt797rPZ7xTNyze8jaFdsCgsugBBhebX8s+9N H34oktVdvAu4xr215qUQhmsMOuI6R6fuzU4bHXAMTxORaHMuI5UgB/2eCQT4cxVa3mJ+ owbu1bp1+5UKP6RlAL4akpdtGbyxpnAq1JYYdeDKwuCVQubh9vjfrCUpnfFcx6eZbKze clDcYJIlaB2HmyZoglAD9PBTFXBfIE5NUZQ2X8xlFVFUHK2aTjuO8drtHHpQJcu+f/GY DihhXSdDvDuv7/A39VJJrFxwaucWNSu4gqs3TzdYiChAnB3AfCZ38S33M9Ec/tJ2O2IP TrTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GwQacHVq; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a170902849500b001b3d822f131si6853057plo.239.2023.06.27.08.36.11; Tue, 27 Jun 2023 08:36:24 -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=@quicinc.com header.s=qcppdkim1 header.b=GwQacHVq; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbjF0OwF (ORCPT + 99 others); Tue, 27 Jun 2023 10:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231993AbjF0Ovs (ORCPT ); Tue, 27 Jun 2023 10:51:48 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBA04C1B; Tue, 27 Jun 2023 07:49:27 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35RDVfNM000853; Tue, 27 Jun 2023 14:48:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=hFqgsytwO7YkPhtAzxumxYOYePgrq4GqYMK6wBUKkqU=; b=GwQacHVqAsyMaBPm0rNrGOAnrndoR4OvsstRvd51fRXGEXVv9lAEq7VmBdhhzGQs7q7U Rlh2aQn2gTBH0N2iJE88Z8hIi3QEJW30Vep+ODOlj6LjThQSSR2nSzIy1vtQQgBls1Mi istsCrrnotnMiIVEmvyHVJfYyMVmkVktLv4bgqEwR/5d3lZfAgMYLHOC+gafP0F1+g2/ Q1WfJsDJ6VDk8OLmup3txDq4/gV7G6tpMXq0OOCoUOl0VLtBUCsLLEXnFdUETTFBPibC YBHO46JDDEze6RuFfdtkO1iv0dwMJjnWE74KXRQio2t2GI8Fh8KErI7v64mn99Lyyk3A Jg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rfc02aqqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jun 2023 14:48:33 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35REmW27011345 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jun 2023 14:48:32 GMT Received: from [10.226.59.182] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 27 Jun 2023 07:48:31 -0700 Message-ID: Date: Tue, 27 Jun 2023 08:48:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v2 10/24] bus: mhi: host: use vmalloc_array and vcalloc Content-Language: en-US To: Julia Lawall , Manivannan Sadhasivam CC: , , , , , , References: <20230627144339.144478-1-Julia.Lawall@inria.fr> <20230627144339.144478-11-Julia.Lawall@inria.fr> From: Jeffrey Hugo In-Reply-To: <20230627144339.144478-11-Julia.Lawall@inria.fr> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: aLe5CmSgeSsnVXgSXq5v5pCSDBN7aPz5 X-Proofpoint-GUID: aLe5CmSgeSsnVXgSXq5v5pCSDBN7aPz5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-27_09,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=746 spamscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 clxscore=1011 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306270137 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 6/27/2023 8:43 AM, Julia Lawall wrote: > Use vmalloc_array and vcalloc to protect against > multiplication overflows. > > The changes were done using the following Coccinelle > semantic patch: > > // > @initialize:ocaml@ > @@ > > let rename alloc = > match alloc with > "vmalloc" -> "vmalloc_array" > | "vzalloc" -> "vcalloc" > | _ -> failwith "unknown" > > @@ > size_t e1,e2; > constant C1, C2; > expression E1, E2, COUNT, x1, x2, x3; > typedef u8; > typedef __u8; > type t = {u8,__u8,char,unsigned char}; > identifier alloc = {vmalloc,vzalloc}; > fresh identifier realloc = script:ocaml(alloc) { rename alloc }; > @@ > > ( > alloc(x1*x2*x3) > | > alloc(C1 * C2) > | > alloc((sizeof(t)) * (COUNT), ...) > | > - alloc((e1) * (e2)) > + realloc(e1, e2) > | > - alloc((e1) * (COUNT)) > + realloc(COUNT, e1) > | > - alloc((E1) * (E2)) > + realloc(E1, E2) > ) > // > > Signed-off-by: Julia Lawall > Reviewed-by: Jeffrey Hugo