Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp634536rdb; Tue, 23 Jan 2024 09:52:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+YFPWmzAn+liMzPCY9k6nJSg3sjyBrMIJXAXYv0jmLsWmkvdmjMx7Al2ZQrEt1cXoW1SS X-Received: by 2002:a17:902:70cc:b0:1d7:204a:80f5 with SMTP id l12-20020a17090270cc00b001d7204a80f5mr4008183plt.14.1706032347729; Tue, 23 Jan 2024 09:52:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706032347; cv=pass; d=google.com; s=arc-20160816; b=Lql6xUO3mwniqRix+595b6tZPK8QhttGCfp1a7iIqaFN8qndbP4gkw9PIqKO+DbP/x zcmDZo/Klwhl616HoHi8UKgjpMoccRPlY5zKD+0/04mMYzn6wZGYRd7N5pLYj4u/+bqC O+RzhwBlFA53MMiMgq+/tpSdJlACvb3qj/S3dx6VtjB5/8coThSdM8rIhfV0Q0smllBO EziB45MLVtkJWkCkiHn7FIS5ud5TS+1OGr6V8RZ1tcAuN9WK+8LwiLWAQdkSn6+gC/9Q iZpevkVVJwDW0/1vpnfxy+shXj0P5FrLty5IOQg7fVwXdiRwpwbO2OcdpDoRd/uSKTBQ mH8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=W4oyBrQ4+qtvNHd22bRaiLV27J7OcLKPIojk24G7ULU=; fh=uDqGoHpZq40jnjzHdqMGuxYf2ZqKND6DDIgWw7+XVsE=; b=K9XOFdjMpBUK97UZVG9QZlJA9FGFvrhMvWwAlxY3dJ361GIrrCPwNIIY7FJcRBpdDf VzLlgznf3vO6E0esr+UiEii4CEPOce6JWuaShYIQ1sK5+PkUaU6jolCkGZj7XmEjgMeq xfOBSYVI/LtAaPmvwJQkcDy6ObM2L7DatlYEDElMnSa5WUfoDx7lsnBaaDHMtgsS4Oi3 GEuUJXlwtQciJxVD2xlKSCYk2LCzY4UNnvNh/koj/yA5lccrwYlQPIN8VWjATHbPA0Bm bJw0/+Lw1IQV+MdEulaZCwAsFThCYcnXvo0oFiufPm3NxfTSm6k7d8QTYaz/VloeA6mR NuPg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E6fNOKV8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-35798-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35798-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u10-20020a170903124a00b001d55bccfd18si10266887plh.381.2024.01.23.09.52.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:52:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35798-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E6fNOKV8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-35798-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35798-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 38007292805 for ; Tue, 23 Jan 2024 17:45:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B60D7811E6; Tue, 23 Jan 2024 17:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E6fNOKV8" Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3C4811E4; Tue, 23 Jan 2024 17:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706031912; cv=none; b=TG4H/sMevIbta3Vz0uBaZG8OOyQzPYOeHp7KLAox05vCDZZUNdRG6S6F22ziKDBG7+b98C9X4YY2f8H/xSVv4kQcE6ok7fPe+NM7NcxEhSRmkJUxTike7BUxo+aAYDRjelQ2q+x68EeNHMLKHZIMG1zvPgm5H2MN+kBBlvvy6so= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706031912; c=relaxed/simple; bh=hiYpf5YTmy2SgRtEVXbmJOPkhwnjcJIUaFmiSYESsd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TxXAh1hIqyNZyECEPjSjszGYsgU1Kh3OSCFsEB6ea6tBiQSnLS6RsMKRSvAmhJh2AFe3M5GhghQsGO3eq5J1v3anBwd3oruv68BaDGJSa6fU8Hzu1JBLaNhYPQ1KXIhYu8zg4BMTyd7ncWpu5cWRLionRt0DI+2ipFOptcAuu7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E6fNOKV8; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40e775695c6so45190635e9.3; Tue, 23 Jan 2024 09:45:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706031909; x=1706636709; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W4oyBrQ4+qtvNHd22bRaiLV27J7OcLKPIojk24G7ULU=; b=E6fNOKV8eltoEw0cXzEo7w9kUircsqvGkdr52sS9pUBS0BCHqnT78i57GBLojr+wW9 U8Rp2yq+2u1vOMx5LywwxbC6hAYtKZKbPsCyc6RuQqxZ4S5kluSdzzsYdvjJ+NUTauGF K/Z33B4EXqmOkQUGJ8YMU/EUGPvVir3MH7nok9YKx4RsWC2YnN/QfFe6+cz8pvNahi/H iHj1jHXQh2hzb8Bo2+Dy/NQaDKdWgsyXyteJVrfg1ZP7cI2eysBaxRXHwcP0xaPTJfLI pQ1V7e00gba7gbPkIQQdEhO1R+bS533KzZLCALd1KFDn4QCpsNypBr63y1SxuYLpvZW+ tj9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706031909; x=1706636709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W4oyBrQ4+qtvNHd22bRaiLV27J7OcLKPIojk24G7ULU=; b=FwkmQ/8yWeUipg9YP6Nd16O/IAQsIcanQvggCHlYzg+nE9NB2yP6iydas0CyrqNNHY pjEJVKIMbfbjjVc4xV7dppJEEJEj7gYgA3lvc/X0sbKzvX2r5DppnzDL/sw8s9Zxj0+S 2ndiq1QK9fWLqVmkosD/B/c591uaAJGA+UwnL90rUoKkI8Fjk3fxPUysaRgaAwaOW9ST H7z89Ch10wg38wiATNpz9agbY/cxoN8GECUvDE9wfC1VTKvl6pjqbGhKWzfygpHqWW0Y KzJjiTNNXnz8rdfFvdqFe0ZvrPQ8OZ1IS9Goxp2fscm9h+VN3UJnLnCB++SsDqXxarv5 QGog== X-Gm-Message-State: AOJu0YyjsG2UU99JxpX6orgLaQegjHQAm/DhYk/9rjfy0AEl2twrseDY B4N0vGmt0M+CQE3JGN8lhHvrh1dtJTHUT6QbHqv4BkSLO9S8qA8m X-Received: by 2002:adf:e84c:0:b0:337:cdc1:daff with SMTP id d12-20020adfe84c000000b00337cdc1daffmr3997048wrn.71.1706031908892; Tue, 23 Jan 2024 09:45:08 -0800 (PST) Received: from jernej-laptop.localnet (86-58-14-70.dynamic.telemach.net. [86.58.14.70]) by smtp.gmail.com with ESMTPSA id x8-20020adfdd88000000b003392ae3aee8sm9009835wrl.97.2024.01.23.09.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:45:08 -0800 (PST) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Corentin Labbe , Herbert Xu , "David S. Miller" , Chen-Yu Tsai , Samuel Holland , Jonathan Corbet , "Gustavo A. R. Silva" , Erick Archer Cc: Erick Archer , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] crypto: sun8i-ce - Use kcalloc() instead of kzalloc() Date: Tue, 23 Jan 2024 18:45:07 +0100 Message-ID: <1876185.tdWV9SEqCh@jernej-laptop> In-Reply-To: <20240121153407.8348-1-erick.archer@gmx.com> References: <20240121153407.8348-1-erick.archer@gmx.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Dne nedelja, 21. januar 2024 ob 16:34:07 CET je Erick Archer napisal(a): > 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() function instead of the argument > size * count in the kzalloc() 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 Acked-by: Jernej Skrabec Best regards, Jernej