Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp489337rdb; Sat, 27 Jan 2024 16:18:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiwGhNLVyY6/6tY60v4m7HC1f1mKCbbpFAE3X6DcHwG+zN7zDIlHiYQQEnBdw9p9ScLvaM X-Received: by 2002:a17:902:bcc9:b0:1d0:a791:7598 with SMTP id o9-20020a170902bcc900b001d0a7917598mr2130803pls.129.1706401102084; Sat, 27 Jan 2024 16:18:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706401102; cv=pass; d=google.com; s=arc-20160816; b=soz2HeYBLxls+VJQeEqy5HzzGYDy5kbMw126U+bOS79fwi7RtEhpO/BhVLQYagCsLV vmFxDjEaOiAo2W1obti2YyOhnpGZkdWbI8Baf9WnzFoRrQMk/4Mp2Ktc8E2EvAdqxMj2 l5wZj92BTJ0EJCPz1Jp44rIqX5Sak3rfCAVEAUCvkkH1YS7+dlqIKrYN9hddKldovbNU bdf4HHt+8ve0J2CxNllJCvMBhhnzj3uDQMjXeoci6kI9JApHTJwzVg8VXQxZ3AAGU2uY k3DhBfX16VqabkdmLpqHbk/LhY/fNTu20PDDu4hoOizsEgUTJbyrmn0qDdODnU/RzYWg Xoew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=j5U43ZFbCsJb6lHwAcl1F4qcbBRnNSRS/V/qvHROetk=; fh=KlgMKl0lrOtK2xdz+tvMrGCX73CEBHO4SJZYjBIGicA=; b=NEqD6ogkNIVCjNa/ns+puDlPFaq1kfQcCPD4Wz6XcjM+Y158znmg1TbdTTs7VX/kYX 192CRSnkrzVFxEsDJIXSnY0aSPZDQYz78s/lXxet/vIglNYDiOZUGoFmpIk6Cc3UG+qP E2yEM7fyfkNmDt5wZ9q36TsQAkrwCx2V/9WziiBFFy8TUFo7MqWGs1XoLwZqo/fh+qaI 0zlsACqz8ChXMbfTlM1HzsvKix/N/cgpqtcvUnJReReq5GlwyYqAML0H/S0BH6W0gPoI d0O4L/AeV48zq8MpKGlTa5aexfS3tJjTl/nzzSAgOQkn7xGVOsW5wDMqVRVxGY9RwMgP xLsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JPsBH+Bc; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-41476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k13-20020a170902c40d00b001d7204a84ccsi3443494plk.156.2024.01.27.16.18.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 16:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JPsBH+Bc; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-41476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CDCEAB22C30 for ; Sun, 28 Jan 2024 00:18:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F8B3A59; Sun, 28 Jan 2024 00:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JPsBH+Bc" Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (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 9F8E5391 for ; Sun, 28 Jan 2024 00:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706401088; cv=none; b=FvCCN0JVafuQiyF/yCcREKqunQ2mR7ypVbLLe6HuGtAYxjLkIOU8+IVlCtBU11tKVTpI4O/f824pT/WH9qbnG6nQJP0bi5U18/cayPm2h81U6uikrc7DJq32sANoOUO+ZyhosCj9vTkdCYYvxA9N28sJ7vs3lar2AcxG6YPzzJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706401088; c=relaxed/simple; bh=j5U43ZFbCsJb6lHwAcl1F4qcbBRnNSRS/V/qvHROetk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=g8x7xYcLwcUH8dlNRIlzJE8uulVG0Xs/Ef1dlbmh9sJ92iFCPNQTbHrlMcrg0zwZNOZ5CMxTNU1gIrZggsxKqcgHDOXA+x+efEYZjLrYiecYL7KWuQ7GbSiiKco9EnbgWIdujIDHYxeDzSCTPIWyV/cLk5nIRK0vVGEWq+9dd6Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JPsBH+Bc; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-602cd92a75bso15660697b3.2 for ; Sat, 27 Jan 2024 16:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706401085; x=1707005885; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=j5U43ZFbCsJb6lHwAcl1F4qcbBRnNSRS/V/qvHROetk=; b=JPsBH+Bc4/47Z68FUI6jiqsHxV1njVROINNaI1NehFG1rl3cqvLilZP4eGMPS5umSo UIcXlJ787OJVMZBI9tDkRKkY+e7Jn5HQp3cngQrfkT75uNBbC86BgjSxdO64znnEJaXP 6S5XI6DfmAaM5gnUPz2VUpXeCY8ohE8HGISUaUddTCWvo9ewy+xfN6jzKsiI2v+wKZm2 OZ0x1FlKBMDUQKDsL2EWFQWT7kk78gSjYXH9UitPp2JwLpZWZ18MGLaRhUuI+QWNNCKU Khbroirwv+pfui/m21yKITAxx3qEFoCMk4zNBvAhnxldFwdUH/5GsuJILsJaOiVULiSp ztNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706401085; x=1707005885; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j5U43ZFbCsJb6lHwAcl1F4qcbBRnNSRS/V/qvHROetk=; b=Sm6kYeTjVkInGRvSCvVMlVHKCLvQMMkszI3ORChFop7aUc3BpG+GSIg4CNXxLCukvM O2RYBvUWJ2LWtbyjohBMrZXGkVEsnft8Gq0jR5LkoAiNztGvXdPsgwh/WiTi35beu5f7 6toHTd6OGoQHsQZLu7Hk1YGPpO0dLvJPELax8EQBeKyT4DZkSUHRIphmtH/hh60YIhV7 8CMRIe5z+dx+SDD2ga9+fre+9InRtEf3M9as0VwRsjNZ/zGyCFgtRYROHAyW+DzcO/yP a3KLHtnDMF4JM8dAiCvsYC4P2IqCSf4bszrQoBu31mVcN7CUP5+F4nQ2+f1oYIFdd3NI P0cQ== X-Gm-Message-State: AOJu0Yy2kcHncDVdOPg/TIZztImnRVz4rj+zpkUHO9mSJ/nJpkVUDZGL hi6X+me2o6MKe5mTrsXWzs3fzm7Uv0ksWSCG/HHuQiwWxn4XZjpx1pa64UlmyovXMuUHUb+KxAa ucR8LRfIMtsw/2FJEP8BE+97uIzgQpvjY+Vjgyw== X-Received: by 2002:a81:a784:0:b0:5ff:95a8:953 with SMTP id e126-20020a81a784000000b005ff95a80953mr1717410ywh.75.1706401085482; Sat, 27 Jan 2024 16:18:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240119181909.7079-1-erick.archer@gmx.com> In-Reply-To: <20240119181909.7079-1-erick.archer@gmx.com> From: Linus Walleij Date: Sun, 28 Jan 2024 01:17:54 +0100 Message-ID: Subject: Re: [PATCH] pinctrl: pinctrl-zynqmp: Use devm_kcalloc() instead of devm_kzalloc() To: Erick Archer Cc: Michal Simek , "Gustavo A. R. Silva" , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 19, 2024 at 7:19=E2=80=AFPM 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 devm_kcalloc() function instead of the > argument size * count in the devm_kzalloc() function. > > Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-c= oded-arithmetic-in-allocator-arguments [1] > Link: https://github.com/KSPP/linux/issues/162 > Signed-off-by: Erick Archer Patch applied! Yours, Linus Walleij