Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E223C433F5 for ; Mon, 22 Nov 2021 18:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbhKVSip (ORCPT ); Mon, 22 Nov 2021 13:38:45 -0500 Received: from so254-9.mailgun.net ([198.61.254.9]:50358 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230394AbhKVSip (ORCPT ); Mon, 22 Nov 2021 13:38:45 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1637606138; h=Date: Message-ID: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=13j6XBVuZRlOT+crcyS/jgeKW773HvgGp8s1QfJeY7U=; b=cb4A4pzWSW+8F6N5wc8RU86v6ZBhdr4lB+TA0YwYkSO5S3UEiE40h74eaI/NriavxN6mUxfA H7ZGLOQHqLKX1yKxFyOKyC5Bnui7Q4dmIdGnJJ/7gG0Q2eqSZGVQAoz5LZkF2dP9lDFisv8T 3qYM+c1Hht/96w4d3f7GypoQias= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 619be2f95daaeec797c4bc73 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 22 Nov 2021 18:35:37 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D9887C43619; Mon, 22 Nov 2021 18:35:37 +0000 (UTC) Received: from tykki.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 84F74C4360D; Mon, 22 Nov 2021 18:35:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 84F74C4360D Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [v3] iwlwifi: pcie: fix constant-conversion warning From: Kalle Valo In-Reply-To: <20211118142124.526901-1-arnd@kernel.org> References: <20211118142124.526901-1-arnd@kernel.org> To: Arnd Bergmann Cc: Luca Coelho , Arnd Bergmann , kernel test robot , Nick Desaulniers , "David S. Miller" , Jakub Kicinski , Nathan Chancellor , Johannes Berg , Yaara Baruch , Matti Gottlieb , Emmanuel Grumbach , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <163760612835.7371.9754662728498548410.kvalo@codeaurora.org> Date: Mon, 22 Nov 2021 18:35:37 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Arnd Bergmann wrote: > From: Arnd Bergmann > > Both gcc-11 and clang point out a potential issue with integer overflow when > the iwl_dev_info_table[] array is empty. This is what clang warns: > > 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 extra range check makes that obvious to both readers and to the > compiler. > > Fixes: 3f7320428fa4 ("iwlwifi: pcie: simplify iwl_pci_find_dev_info()") > Reported-by: kernel test robot > Cc: Nick Desaulniers > Signed-off-by: Arnd Bergmann > Reviewed-by: Nathan Chancellor Patch applied to wireless-drivers.git, thanks. fe785f56ad58 iwlwifi: pcie: fix constant-conversion warning -- https://patchwork.kernel.org/project/linux-wireless/patch/20211118142124.526901-1-arnd@kernel.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches