Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2193300iof; Tue, 7 Jun 2022 22:46:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCV28+mTdkw05/VWejg14spYF98rbYj2Z9T9Ld+Ogb/bEhoNXmPQ0slFolsd515Gp5tlLO X-Received: by 2002:a17:90a:9741:b0:1e8:a001:5caa with SMTP id i1-20020a17090a974100b001e8a0015caamr8126284pjw.231.1654667216030; Tue, 07 Jun 2022 22:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667216; cv=none; d=google.com; s=arc-20160816; b=W1eB7hLtvouxzx1K34qKUCzEdEuX6jp23m3LdOOq8zKopOHU/qWTEOhDh4W2V26LLS bI7bR9e3R0l+9NVLl2dk8dMh0sMG9/6Mue8dKiGIjNOS5VL5PaCZp1EuHG4HDmbHyq+H EFF+TXWMtgAuTuwD45bIr6kjrktXabvaebFdQNd2tO8b6nLvKFmp4o6h61wShjQlgd5o YyPJUnRVJ/hiz9Ib0KajIaHgoG2anE3Tb2HrLTD3tvkyL4GCJWk5svcz7stHTwvV+yWy /PUv5laSUFecG+36XiLvPv5jS0QPMR35m5cmMFBDxqpKJwMKR9U9S2XU39OFRi5neJMu Ygjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PdI7E1+aVJwEPL9S+zb+aR7kyZArWKfpsZIgp8IyYe8=; b=CwK0qLZtILCaan77Nee03XaOaKwBGGOCkZPcmUjCqQLrjxIfzwxApbndyWSE6qhPHo TmkbylssQjVBawn35MgRpg6QlSXfiWkKQtp0yMQ2uTKQdm9fA7ImDD0Vdtx+k0mTF15t H40YSSuzL1pvcGBWfEZ7jKtUYvUcL1kcEgTEN1I6ibRo6tqQ25NJ9wrlXz0bsKJlquFd cARuc0TRnF/94GkU0Qq5YbNDLz77egT8Vfo1MeA6TEgk0T/hHWFBFwceZMpDo0BJ2i4a sBSfodAD6twM4h2Q4KYXITLezI1h8/+RARhnBKUc/OoQ/r/BjiL7SKweWrTl4uR7GwrW 1fUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hichmx3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p7-20020a170902e74700b00163fe7ad204si27897471plf.0.2022.06.07.22.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:46:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hichmx3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E58FA3CAF42; Tue, 7 Jun 2022 22:11:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386827AbiFHAWk (ORCPT + 99 others); Tue, 7 Jun 2022 20:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382776AbiFGVvy (ORCPT ); Tue, 7 Jun 2022 17:51:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7C219224E; Tue, 7 Jun 2022 12:09:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F247861768; Tue, 7 Jun 2022 19:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C8D7C36AFF; Tue, 7 Jun 2022 19:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628970; bh=iasyDf3C8+XgFrEDFoVVMOvzOcKHCYOqMTpYsSEiVDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hichmx3s2Na1Aa95i0VUtA2IKyd99rkS6dE1byrR4BKlTSE2xV1bM1NqCs2XqbZLW KhsUDsM+x4+wz4SZFiFx1uSRynnQNUF56Q1uD72DXivlPl8XI/UMtOStXjP+E7jS9a gmeZpg5nvtmtlXsYR7WYBFnoyyof+UgRTjX8D8/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 522/879] hinic: Avoid some over memory allocation Date: Tue, 7 Jun 2022 19:00:40 +0200 Message-Id: <20220607165018.029131475@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 15d221d0c345b76947911a3ac91897ffe2f1cc4e ] 'prod_idx' (atomic_t) is larger than 'shadow_idx' (u16), so some memory is over-allocated. Fixes: b15a9f37be2b ("net-next/hinic: Add wq") Signed-off-by: Christophe JAILLET Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c index f7dc7d825f63..4daf6bf291ec 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c @@ -386,7 +386,7 @@ static int alloc_wqes_shadow(struct hinic_wq *wq) return -ENOMEM; wq->shadow_idx = devm_kcalloc(&pdev->dev, wq->num_q_pages, - sizeof(wq->prod_idx), GFP_KERNEL); + sizeof(*wq->shadow_idx), GFP_KERNEL); if (!wq->shadow_idx) goto err_shadow_idx; -- 2.35.1