Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3334214pxj; Tue, 1 Jun 2021 02:55:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx8dVjgKAS/m8nvvHSccx+pnem3sInCWknxyOmRnSHZcYgPLNgcmgSQxuv4xLJ2hl0v3R5 X-Received: by 2002:a17:906:8482:: with SMTP id m2mr42448ejx.314.1622541359621; Tue, 01 Jun 2021 02:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622541359; cv=none; d=google.com; s=arc-20160816; b=VpJUwg2tSYU4/tmY4QGQ3h1FtRtFrhnxMZPYlvhcKivHZFgUowdurszgtAxgf14uFH 1+0ODVNZnAAWxnOdpp4QFzX7CV58z3o6zIHXFy+XxO3Jp882FLJIhPuyA4I1s0UqB7FJ CamRGmxziBgeid+Ad+f739OiGG81b1MKCSmdabrfo7sFUwTTaB229eth7iHBnWRJaRuw 6AakNd+Nlh63Ce1Z6h3iT5U4YSO66Fj9CbHRUP2iSOhTVJMz6g7sl5MupWtiTtbPPgXV wJgTQ1XjlweAUJAC4hMnFMQ3TGLWuJwQi747P8iZcmOAgthnsxSHumfYY/Dlf7s/AgH5 IeaA== 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 :message-id:date:subject:cc:to:from; bh=uXOe4dc82kGDmyMcqUEY0nKWxJEc4KMmYR6ndNn5LN8=; b=qOi/f6M/i4gn6fL4/s/WXXiH9oSnEmg4muvpJMdv7oN/lFXpImxK2mjaoaThi4ksrF 5sOlrKdcEZBM0UVXroyKfqNT5fKv3BMsqEYmEzXdLxpCq5KZawBDEkfWuEm5slk8Jeo5 yd3bcI3Ii4G/mUez63B1ij71LG142NW0y4CezFWe4zUC52RE7ZmNiUbUY/9DBUCHctAt 4AOw/+T7piw8PbZlgiRhXRIe7sR9YujI/Qj/p5NJGjgmWiqhKOsDHHJLKmGDSeO6lpKA ea0SnhdM1bnEde3hLnrmbrTYuTavZSKIeQUz9Hjtp1TJUDYWKN0xSHvr0Gnx/4SkeaKT 6yEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si17602486edy.550.2021.06.01.02.55.28; Tue, 01 Jun 2021 02:55:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230282AbhFAJyZ (ORCPT + 99 others); Tue, 1 Jun 2021 05:54:25 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6110 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231968AbhFAJyT (ORCPT ); Tue, 1 Jun 2021 05:54:19 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FvS7P5xmXzYpX7; Tue, 1 Jun 2021 17:49:53 +0800 (CST) Received: from dggpemm000001.china.huawei.com (7.185.36.245) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 17:52:37 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm000001.china.huawei.com (7.185.36.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 17:52:37 +0800 From: Tong Tiangen To: Herbert Xu , "David S. Miller" CC: , , "Tong Tiangen" Subject: [PATCH -next] crypto: nitrox - fix unchecked variable in nitrox_register_interrupts Date: Tue, 1 Jun 2021 18:01:55 +0800 Message-ID: <20210601100155.69681-1-tongtiangen@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm000001.china.huawei.com (7.185.36.245) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Function nitrox_register_interrupts leaves variable 'nr_vecs' unchecked, which would be use as kcalloc parameter later. Fixes: 5155e118dda9 ("crypto: cavium/nitrox - use pci_alloc_irq_vectors() while enabling MSI-X.") Signed-off-by: Tong Tiangen --- drivers/crypto/cavium/nitrox/nitrox_isr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/cavium/nitrox/nitrox_isr.c b/drivers/crypto/cavium/nitrox/nitrox_isr.c index c288c4b51783..f19e520da6d0 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_isr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_isr.c @@ -307,6 +307,10 @@ int nitrox_register_interrupts(struct nitrox_device *ndev) * Entry 192: NPS_CORE_INT_ACTIVE */ nr_vecs = pci_msix_vec_count(pdev); + if (nr_vecs < 0) { + dev_err(DEV(ndev), "Error in getting vec count %d\n", nr_vecs); + return nr_vecs; + } /* Enable MSI-X */ ret = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX); -- 2.18.0.huawei.25