Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp255469lqp; Tue, 11 Jun 2024 03:43:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkcsSGZh49pk3lppvHheJrlqk10UXJzVPFRb05GrdJ86yLSftMiNfNJTsxQi9w776rCCDyC1f2MnZ+u2wocSEXuDECuo+eRiO5PLWebw== X-Google-Smtp-Source: AGHT+IGfUG+8HYeqUmvRhNlLSwH6oK6o1YFaeC/TOwTteowVUuMTbqwmQuhiqGri6CzOyugoOFnp X-Received: by 2002:a05:6808:3088:b0:3d2:2f52:c60f with SMTP id 5614622812f47-3d22f52c9d2mr3865597b6e.21.1718102604996; Tue, 11 Jun 2024 03:43:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718102604; cv=pass; d=google.com; s=arc-20160816; b=I4ah1/ltpLYCYuJfWV3HHTid5aXP1IVIEtBZWka8lAO10AjdpcSd9plJpyuEjvywHM XR7jcry4SgU7vzx8L37MNXKIIB8txLnYwTp4QgIH5Zns7P0rVKYAGAL+jLkVOD/4+on8 evtOiS6ijOdEUIjhobWjpfPAohSfOdjRtw4ZIzktuN083c2/hS0CT1O18xV5i/diprZd 9Z/yq8e3YM6weTlZ7TAL8a4cPkE302WOak49ehn/twc5Si2G7TmTQcf5ES+guYbSbRwG xOTG/Qzh6j6JQbTvSwOYSGvEaSDNOGa/E9T3hixPGaPXwULwz8V7EfdJ0kzX1U7qDJ/L zs/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=AqWk9ArA2Y+SiQjWGZ6M3cZ+efa7B9xg+dOeBNXvmps=; fh=ECvoELNpRNykl0UqRL/10jqhH432FCcXGPrzk8Lw+vc=; b=I4VS/uR/QazyFZL07Vzpp9zHWemmBvr+3rzhgJ1jno01XZDRr7QuWxCsw1vrC1QV6v 5LVXvLCASDGbwYu3f8TWEGhdiiVrYfymo48L3XuqL9efvG+/1wd+iUS/BzNcd6owex8y gxVtubP6AeTcZXOjKqBOzME666c6Z6TshUVwUWbd8VOfa3W5+25vU9fVVxfT6Dmtqsu8 yWR9pQ52oHzJ96FLawoebvQfvLKvHYtKwWXZpEnjuqWCI6jknGC7G3YUA0sAAYixKlP3 85oSm5C+cjZz3rsJmVLHJyZLLG3JBJLkgM8EijkoXnGYMG+fCgsZTA0ex5SoTfYiSbQh n7EA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-209668-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7041b066740si6554545b3a.119.2024.06.11.03.43.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 03:43:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209668-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; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-209668-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 06235286ABA for ; Tue, 11 Jun 2024 10:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4AA7178CD9; Tue, 11 Jun 2024 10:42:19 +0000 (UTC) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 373CF7407C; Tue, 11 Jun 2024 10:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718102539; cv=none; b=AI2LiYsz/VWBGNsNe8CdZ8xbCNnFiCCrXD8hJHv37nTJV7MA5liJlOH+S4yrRJBMMjdbkFGtizH8u34YuRa5dIJyfaSyro/ClA1omcnqPvEl9jdiqHx3n3zTjlxvlc4SbL8VzwoHyhxK4/9Yr4aM9sWHF0kFEPEH9+a5Ilv3PHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718102539; c=relaxed/simple; bh=3Izkffgpe9AwSgB3tbJpYn0cnYZH8KaRa5AJSvxQ0Ag=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=MOq2wz5uUAfJ7RwESueFeJOQ02orDzw5TLImLgBe3y+YKxK1X2n8qJCE2o8/0VOtsbf4W3sCZVgrPyeB/UTLuKr1N+pwwwRak4EG8dEGuYy9yez9uCNpoZWbgWJ5SV7OBKRBmJ+gkQ9TZifah+XnThNEgnIcFrk8wgEeIYIidac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Vz4rb6tSNz1SBpk; Tue, 11 Jun 2024 18:38:07 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id 5081818006C; Tue, 11 Jun 2024 18:42:12 +0800 (CST) Received: from [10.174.178.247] (10.174.178.247) by dggpemf500002.china.huawei.com (7.185.36.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 11 Jun 2024 18:42:11 +0800 Subject: Re: [PATCH v1 1/1] ACPI/IORT: Switch to use kmemdup_array() To: Andy Shevchenko , , , CC: Lorenzo Pieralisi , Sudeep Holla , "Rafael J. Wysocki" , Len Brown References: <20240606165005.3031490-1-andriy.shevchenko@linux.intel.com> From: Hanjun Guo Message-ID: <3a1e0ffe-db11-d18f-db33-881df7d9b18d@huawei.com> Date: Tue, 11 Jun 2024 18:42:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240606165005.3031490-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf500002.china.huawei.com (7.185.36.57) On 2024/6/7 0:50, Andy Shevchenko wrote: > Let the kememdup_array() take care about multiplication and possible > overflows. > > Signed-off-by: Andy Shevchenko > --- > drivers/acpi/arm64/iort.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index c0b1c2c19444..e596dff20f1e 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -822,7 +822,7 @@ static struct iommu_iort_rmr_data *iort_rmr_alloc( > return NULL; > > /* Create a copy of SIDs array to associate with this rmr_data */ > - sids_copy = kmemdup(sids, num_sids * sizeof(*sids), GFP_KERNEL); > + sids_copy = kmemdup_array(sids, num_sids, sizeof(*sids), GFP_KERNEL); > if (!sids_copy) { > kfree(rmr_data); > return NULL; Looks good to me, Acked-by: Hanjun Guo