Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp225176pxb; Fri, 29 Oct 2021 08:44:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR2UrBtcQWVmwLfM2RbdsyioWsQ/llTUYNL8LHci0HewRjHQc9N6B+W/3wNyjwWvYvH/6j X-Received: by 2002:aa7:c799:: with SMTP id n25mr1220798eds.144.1635522246814; Fri, 29 Oct 2021 08:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635522246; cv=none; d=google.com; s=arc-20160816; b=IEIRLYPTMJKD2zo1pIxdTlwGW/NaN2eFcxLxsiZ7N0IlagbtT6ksxguXpadUapzq3M ftX5SdAD9Tycu+X9OPQxe/p7+x9oMfE2kGZrj2YuH4qRX0/yvxj4he9Fdq6gP8qEpEEv YPJZ3NBkYkK0GJQn2BSCVy//GNSXFnRag0HcdfSVMPL5DphCj08rhB9ZivqEaKuN7rA+ qi1I0BsyibykDD2NJBnNmb+dFLC197qRJk0k3kIDsXPLs+lwiRL5jot71I2CY5HkEKs2 zvAIi8FDD9OlCujRndJrFsL1mIZFzEhgYFsp2/dr6mIOJOnOTPu5QJxsAstciuXdsnXL grvQ== 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:dkim-signature; bh=IyzKZ23UKJbu03goaLA7WO/xiqaZyS5RcbqUJzknL5Q=; b=bbZhYXm6HtjbtRmo4qX5WmUknZCCQQ1qGmce0gjnoMpPSaJvm8Mt73FjUru5N1nTGo Fdw2OfbC43uAdCSwkLqQXBPKNXOkqRJEFAfIuLACAHi/d7OXsey6hdBHbb08a1pfgdRx 36TkFnEK4nEXTRnxQGKZuuuACEQE9Dza2U5Ymyi433WE4hZZ+gar3PwTmeBWNZ94mNkG 06hsJHecHHA5BeVrbkpbQbrMFa5Xwt3u3UrlDHJUSUcPguiIyXvvS7G2V3y+fjExFz0B WrJ2Ygq8c0BQ0t9JisqKJ1DsVSx6YdFlMV9P6qmAkFQI1WO3bbeUyi9sp57MG1waBWrU H2/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DUE9p0WK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si7900703ejm.641.2021.10.29.08.43.27; Fri, 29 Oct 2021 08:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DUE9p0WK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbhJ2Pph (ORCPT + 67 others); Fri, 29 Oct 2021 11:45:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:50556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbhJ2Ppf (ORCPT ); Fri, 29 Oct 2021 11:45:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E1B861181; Fri, 29 Oct 2021 15:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635522185; bh=EKpljgVa5r5UmD2IEpypElISm7qojaXBWVSnqjIx8EI=; h=From:To:Cc:Subject:Date:From; b=DUE9p0WKnSWBxCzU791qowB58og7xeQNSE+jvOr1AKoxKnhkoir2yzs78lYIslDXB FkE/zSncUhI2lA2tKUexN3X3Q5AYvoam/0VqTPisHApFRfY6pSFASrjziUwf9cJw/J 5EqV9PzRuXmjhWYvbpOSI2a+sC27jG+66ztNgD0SlLfEnCP9xi7yZw5bnkU7zq1yNk Zi0z7TpI3fQL3b2Xepxi1+kZRIozugkx+CwlqoEAJSOQXpXOELDKtHcvPADLl9vrx3 pZay4F1IeCUQPTS7H2FclvL4K6vt+ZMEB97l1RFIB+DbfJHN4Pz1kak4gspPq3KprB AgktZwKqMjE0A== From: Arnd Bergmann To: Johannes Berg Cc: Arnd Bergmann , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Nathan Chancellor , Nick Desaulniers , Yaara Baruch , Matti Gottlieb , Emmanuel Grumbach , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] iwlwifi: pcie: fix constant-conversion warning Date: Fri, 29 Oct 2021 17:42:29 +0200 Message-Id: <20211029154253.3824677-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arnd Bergmann clang points out a potential issue with integer overflow when the iwl_dev_info_table[] array is empty: drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1344:42: error: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1 [-Werror,-Wconstant-conversion] for (i = ARRAY_SIZE(iwl_dev_info_table) - 1; i >= 0; i--) { ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ This is still harmless, as the loop correctly terminates, but adding an (int) cast makes that clearer to the compiler. Fixes: 3f7320428fa4 ("iwlwifi: pcie: simplify iwl_pci_find_dev_info()") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index c574f041f096..81e8f2fc4982 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c @@ -1341,7 +1341,7 @@ iwl_pci_find_dev_info(u16 device, u16 subsystem_device, { int i; - for (i = ARRAY_SIZE(iwl_dev_info_table) - 1; i >= 0; i--) { + for (i = (int)ARRAY_SIZE(iwl_dev_info_table) - 1; i >= 0; i--) { const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i]; if (dev_info->device != (u16)IWL_CFG_ANY && -- 2.29.2