Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3590779ybk; Tue, 19 May 2020 08:17:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRohboINtiqiL4IYhHRZ2s+Fdeh3i1wamoDQzK+HJOwQUhVg6/ooNhLDivv/pwd6dnCHdN X-Received: by 2002:a50:c60c:: with SMTP id k12mr17848060edg.111.1589901441735; Tue, 19 May 2020 08:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589901441; cv=none; d=google.com; s=arc-20160816; b=AZkWjyLiug9kKpDP5IfWruYRysFPdROmzvQBA7XUeQMuCKWMb3QuoyTj0R/h+1cxKc re0SotUciuzPM4iH9vwooNBWYyxcedeJT3FzRpa9VUrtVQW6jq857i2O61MzB6PIRF8B TJdCyLXIffXmjoH33NtsHhqg3dOzxzZXNY8s/DH76/SPmh7q3kvP25ySiMszJYbUwje7 DQCsK9k8CcVvyhW+rNZIxd+MpHk3AlMhjrPJDDRaj5IpnBHnqRx5RB+hgrSjHJTXR3D6 C4SeVgQJ4T9etDIx9fay0Vz1poaOKkvvrsnKYEPRRQ+rZ5wzKJGMKAR/r9/DmWb8lJlo dKeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=SAMK1G8QvwxbUwhmkKGusRUlYMotJBhyYHwHk/TjFKQ=; b=azkHP1Pfbkam/9PqddMWXk93MAk2dBd72Hz5Il/n4UPYyEsX1PKABySxQWypLFVyEQ +sJg2oRFJ6spL1kHDamDtpwf9Zbft5BvLzHn10st9XPcUuAKp6z8daIVDNh27LsvGHPQ lo7w/gNMWEBj0tiWJS7+KA6dIIrQehmnDjVXUBRdjBFLJ8jWzZcaUSLm4haQ5kvA4gsR jFJBP5I9xqLv9lB/JpdBvBRvZaMb/7t43WyID18OmEman/WqU7YNvP2KJP8CJAsVGGmA iBsRyiWFY2u233d1PT8bcmH8dSaj4lRPg3s+H0TYDqiL68L20M3TWHftFo8KvsrarqSY 9ZVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si19286ejg.10.2020.05.19.08.16.58; Tue, 19 May 2020 08:17:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbgESPLp (ORCPT + 99 others); Tue, 19 May 2020 11:11:45 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:14524 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728773AbgESPLo (ORCPT ); Tue, 19 May 2020 11:11:44 -0400 X-IronPort-AV: E=Sophos;i="5.73,410,1583161200"; d="scan'208";a="47275375" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 20 May 2020 00:11:43 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 98954400516E; Wed, 20 May 2020 00:11:41 +0900 (JST) From: Lad Prabhakar To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Lad Prabhakar Subject: [PATCH] PCI: endpoint: Fix epc windows allocation in pci_epc_multi_mem_init() Date: Tue, 19 May 2020 16:11:20 +0100 Message-Id: <1589901081-29948-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix allocation of epc windows with the correct size, this also fix smatch warning: drivers/pci/endpoint/pci-epc-mem.c:65 pci_epc_multi_mem_init() warn: double check that we're allocating correct size: 4 vs 112 Fixes: ecbae87 ("PCI: endpoint: Add support to handle multiple base for mapping outbound memory") Signed-off-by: Lad Prabhakar Reported-by: kbuild test robot Reported-by: Dan Carpenter --- drivers/pci/endpoint/pci-epc-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/pci-epc-mem.c b/drivers/pci/endpoint/pci-epc-mem.c index 2325f74..80c46f3 100644 --- a/drivers/pci/endpoint/pci-epc-mem.c +++ b/drivers/pci/endpoint/pci-epc-mem.c @@ -62,7 +62,7 @@ int pci_epc_multi_mem_init(struct pci_epc *epc, if (!windows || !num_windows) return -EINVAL; - epc->windows = kcalloc(num_windows, sizeof(*mem), GFP_KERNEL); + epc->windows = kcalloc(num_windows, sizeof(*epc->windows), GFP_KERNEL); if (!epc->windows) return -ENOMEM; -- 2.7.4