Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp17706rdb; Mon, 22 Jan 2024 10:26:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOraTOBTIksA6vghW+b0smzNg3VfB9KtMvsgAixgt6GFJT8cw4mpPwUG7sdHYlPnQcOOHj X-Received: by 2002:a05:6214:224a:b0:681:3a66:7359 with SMTP id c10-20020a056214224a00b006813a667359mr6082621qvc.70.1705947979678; Mon, 22 Jan 2024 10:26:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705947979; cv=pass; d=google.com; s=arc-20160816; b=QIYor+bxDgPDJIaPh9FGvyYglNtKnwcg4S33ZG2YFrnnSpnhFKAXnrxB5ygxjx7p8z 9aN9l+058CxhsO3Tx3UKmbj7LE2J9h3RebfuXbK4ZJqjB62tBwOs+mXDXxyGYANJQ3NV 7vtQOVg+qM7bN1aK4+eXbABaRA9TIksBn/iRFWRP29hobJUoDDE2RoK8h2QStt1iwvWn 8yzfTXzEyPkZUyDCklaMkfbABTk8HsRmqyu4yCr6/hf1GA1asCfr7tIQitm52tpvrvMm JFKMD2qDDJxGdOuycteUpevBGOFF9tjixLS+LHUBgDO2H4fTHmlotutJ2OvrE/QqvHhg xCWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=PEtLt9oS/A4lBJWHGJooEwE2XUDT6cLyAvihhnF+I0U=; fh=m3LLUTSRNoEcU84LLh7y1hsGrbf/eit+kKgW5Pf+nsI=; b=qGqpZrYhCEV8tNsCAp5UCxwHNgBIDGuOFpuLuhd9h2XIkhb9r/2bp0rspxvMBtMmJ3 Kv2gTQ9/fdBzqZuLclHMKutAVLMpe0S1f2c2hJLekf71db4Yl/+HROYOUNKwRsnFUzPG 3m8vBu/ep6iWgepgkKpFhFG6FlXH9U21HTEkTmX9U/Itis+mLFa9+mreFjrd7i1yn4Cx rW2+bWp64AOZD+3AiqhS0Io753/kp3jjktnZncXr9D4jhmoFmtB7btIyb6qPmMfe5TZT gojFwnoShaSJe6NO6Yfk3y2VgsNQ/bqyuQcsGLYv/A8tVd85+Zv4oeOT6OjcHZGaL03a BhrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=Srjqd5bS; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-kernel+bounces-33876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33876-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x27-20020a0cb21b000000b006818433b30csi6097297qvd.600.2024.01.22.10.26.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=Srjqd5bS; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-kernel+bounces-33876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33876-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A8FDB1C24B92 for ; Mon, 22 Jan 2024 18:25:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BA794F8B5; Mon, 22 Jan 2024 17:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b="Srjqd5bS" Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08A6F4F8A0 for ; Mon, 22 Jan 2024 17:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.202.169.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946128; cv=none; b=ShvJjPXaIVW3huA9h3RcHZAUPjuxECSM4TY9Q1fQxzw5NrPM/rsTkNs/mPuzaRXIUdRN7MIfPK2xB2uqbxOaMNgMyX/m4DQzBaVn3JPFxjntZKJ+jagod1QDAitHrWbd75UdOXlSetzgKydRUN/mUmmV4P94EnOvHobc7SlZI68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946128; c=relaxed/simple; bh=Z+Opmu1Rt4tCX5MVhj54+D8/vXKM22/2IAw30+KabVE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iE8C3w6XDmHSwo/QBqZHRWbYb36lbNYm7HAuubG/2o2qqmpPAQQRUhOhqKY7pvedPLN7xKB7cfqd++dsY+PsNkC7YWr6ADjZPhMDBJ0C4j+MtmW6ZFKE5P4t/dDW2vMVGExRkDJsWTKzX+JcbLjtkIamP7F4MJ/b6BlW6/qKROk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com; spf=pass smtp.mailfrom=embeddedor.com; dkim=pass (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b=Srjqd5bS; arc=none smtp.client-ip=44.202.169.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=embeddedor.com Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id Rjf7rN0sJAxAkRyWNruiSv; Mon, 22 Jan 2024 17:55:43 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id RyW5ryhXOfPByRyW5rmW9P; Mon, 22 Jan 2024 17:55:25 +0000 X-Authority-Analysis: v=2.4 cv=T+af8tGQ c=1 sm=1 tr=0 ts=65aeac0d a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=WzbPXH4gqzPVN0x6HrNMNA==:17 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA:10 a=wYkD_t78qR0A:10 a=VwQbUJbxAAAA:8 a=NEAV23lmAAAA:8 a=7YfXLusrAAAA:8 a=X4DcxGvjouP_kjswVi4A:9 a=QEXdDO2ut3YA:10 a=9cHFzqQdt-sA:10 a=PUnBvhIW4WwA:10 a=AjGcO6oz07-iQ99wixmX:22 a=SLz71HocmBbuEhFRYD3r:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PEtLt9oS/A4lBJWHGJooEwE2XUDT6cLyAvihhnF+I0U=; b=Srjqd5bS66K1VHZzHNR/VDn6bM O8nGJMCIpPXXVK488IbkEG9R2qSOwCWKT9JU3A3h18UdGkIq8XUMQ6lkg3eiOTpd8inE4i+f0D8dM KUcduplO/sJ7N0akRnvqZUOF4w3yC/dOGye1Gdpj8uXyiz7dC+m35NJtKo9pnWThUKPE2Fm9bl0v6 BayhLprpkTBS3Qu4ejIcSgxHxmqGjEjTB7BcF6fmdGKMkDlyfr6etzH5CT9B7WVW47WtkYSKexQc+ vQ8LtzDbvIzWDADrv9JHZfS9o/UXq2mPbnFULxQWtDiDBxz+1KQ0h8DGSxSGOKGYwH8BBdELMfyyu gY1xQGNg==; Received: from 187-162-21-192.static.axtel.net ([187.162.21.192]:37538 helo=[192.168.15.10]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96.2) (envelope-from ) id 1rRyW3-001MU8-0k; Mon, 22 Jan 2024 11:55:23 -0600 Message-ID: Date: Mon, 22 Jan 2024 11:55:21 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] crypto: qat - use kcalloc_node() instead of kzalloc_node() Content-Language: en-US To: Erick Archer , Giovanni Cabiddu , Herbert Xu , "David S. Miller" , Tero Kristo , Andy Shevchenko , Damian Muszynski , Shashank Gupta , Tom Zanussi , "Gustavo A. R. Silva" Cc: qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20240121164043.11222-1-erick.archer@gmx.com> From: "Gustavo A. R. Silva" In-Reply-To: <20240121164043.11222-1-erick.archer@gmx.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.162.21.192 X-Source-L: No X-Exim-ID: 1rRyW3-001MU8-0k X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 187-162-21-192.static.axtel.net ([192.168.15.10]) [187.162.21.192]:37538 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 54 X-Org: HG=hgshared;ORG=hostgator; X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfI4k951azhU4L7Xqg0pAUbI/8m5NpvoSzs2Uzphv7V7bA3WKICq1NFfQ/3YnNLEqMYfY3PSyWykAcXech/3SqEav6InLc0Rg2wyh7qeGvpkJbFIJFI1z 9TjSNEDnKP2bQ0xCyXI5mJrI11J8JQSiy4+TDKW9uK/nZa3uFdZnzCttLZ/Q7FcKrNDGn9C+SfENl5sinyBiRt0I+H71FI6PrZtIo5Nqp+98C+QcM8fM9+NX On 1/21/24 10:40, Erick Archer wrote: > As noted in the "Deprecated Interfaces, Language Features, Attributes, > and Conventions" documentation [1], size calculations (especially > multiplication) should not be performed in memory allocator (or similar) > function arguments due to the risk of them overflowing. This could lead > to values wrapping around and a smaller allocation being made than the > caller was expecting. Using those allocations could lead to linear > overflows of heap memory and other misbehaviors. > > So, use the purpose specific kcalloc_node() function instead of the > argument count * size in the kzalloc_node() function. > > Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] > Link: https://github.com/KSPP/linux/issues/162 > Signed-off-by: Erick Archer Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo > --- > drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/crypto/intel/qat/qat_common/adf_isr.c b/drivers/crypto/intel/qat/qat_common/adf_isr.c > index 3557a0d6dea2..a13d9885d60f 100644 > --- a/drivers/crypto/intel/qat/qat_common/adf_isr.c > +++ b/drivers/crypto/intel/qat/qat_common/adf_isr.c > @@ -272,7 +272,7 @@ static int adf_isr_alloc_msix_vectors_data(struct adf_accel_dev *accel_dev) > if (!accel_dev->pf.vf_info) > msix_num_entries += hw_data->num_banks; > > - irqs = kzalloc_node(msix_num_entries * sizeof(*irqs), > + irqs = kcalloc_node(msix_num_entries, sizeof(*irqs), > GFP_KERNEL, dev_to_node(&GET_DEV(accel_dev))); > if (!irqs) > return -ENOMEM; > -- > 2.25.1 >