Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3118154rwb; Mon, 15 Aug 2022 18:33:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4P7gJvv9BYhhMYtwHgpfhoeVBUgqtEys8zjlVL6zCjguifK5eBgzGm2/Wc6p2ZipT0iPZs X-Received: by 2002:a17:902:be16:b0:170:8ebf:204c with SMTP id r22-20020a170902be1600b001708ebf204cmr20313262pls.47.1660613620066; Mon, 15 Aug 2022 18:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613620; cv=none; d=google.com; s=arc-20160816; b=0fidoY1DfjjL5qMx29005B0jyEXeGlkAYg4eGR0u5HcTYqnub6I7PryDiGCMib9Pvh sx7jiAY2Kyh3tWZq1aLf4bjGMDpPdPCeorbs9FE3F1VCRdehWdU/IXOIaZ9jZjDu1AdT a0zyDf9jgyRGfdZvZldk9Pd9HDgVTFWpHc9YrZF1F4/+XeuDxp8zMC66dJCyqGm+0SS8 rBPKyyZdfQVfcR/0+PtDrofvQpzdwpTPSD/jgCZgIlz3ZNPfKePujLfs5EJQv/ZPhMRF R/sQmlc2lhq7FWygQowBwDQi2ulxlQPyHEwBAb5ClLf2ao1fdPEnkdc5nz6i/MqJGKH+ 8Fdw== 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=gTLAbGI5trudTt5AAYgeHFVwQN7nN3TQFOCLDoz5xik=; b=P6X4pLdTZsTmZEqVfnbQzA3Z0odvxIygK/BXpALzq5PO7Q0ZziSw+TxqNMF9vFucw7 YS+nRRL4dbxlPe0aYdnq6gHfbN876dhmPUusNPQsD6lpJ0i2dwrtlPKQt/+1Lw+mE1bJ bENDQQCEqvCoHqLEfFsVq1DEmjcLaHI04h+dtQLNqfRuWg7ZbOyZ1tREMd+0rttLGWDt lhW4o57B6ycs5kj2LsnPhGYwkz+TS/eVHdyl1I2iFkSxHau/OQLK3x80aF1uRfO+hKfS lvi15furc3TfikS4+OAa+usXTEnOPWKqlVti5z6NicaeWyp2rnZfpbzegxB9pSOlYxJ3 Q4fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pP7SVzc/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a170902704b00b0016d15070027si11345433plt.352.2022.08.15.18.33.29; Mon, 15 Aug 2022 18:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pP7SVzc/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343785AbiHPAmf (ORCPT + 99 others); Mon, 15 Aug 2022 20:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233161AbiHPAkd (ORCPT ); Mon, 15 Aug 2022 20:40:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B54D18E59D; Mon, 15 Aug 2022 13:39:06 -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 C029561227; Mon, 15 Aug 2022 20:39:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9072C433C1; Mon, 15 Aug 2022 20:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595945; bh=wxMfdwVZvjP6alCHyjMscEaeC6bSmN+uCUqkEQ9aJz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pP7SVzc/ZAN0Id1PuMUVufjRg1HBiLNY4RGA149BvJB7G9Z9Ap3ylDUCNRtDRrhvr /ZJyB+snn/kiWVGyqLW4uj1EP+uDN0zQb+MVZBR4rkYRRAf1s31QO85v0p2EHzndrX 0YVBbaT4fJSAkwSZgykx+9KsaKh5tmVDuqJK0Gq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Yury Norov , Sasha Levin Subject: [PATCH 5.19 0924/1157] net/ice: fix initializing the bitmap in the switch code Date: Mon, 15 Aug 2022 20:04:40 +0200 Message-Id: <20220815180516.418041560@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Alexander Lobakin [ Upstream commit 2f7ee2a72ccec8b85a05c4644d7ec9f40c1c50c8 ] Kbuild spotted the following bug during the testing of one of the optimizations: In file included from include/linux/cpumask.h:12, [...] from drivers/net/ethernet/intel/ice/ice_switch.c:4: drivers/net/ethernet/intel/ice/ice_switch.c: In function 'ice_find_free_recp_res_idx.constprop': include/linux/bitmap.h:447:22: warning: 'possible_idx[0]' is used uninitialized [-Wuninitialized] 447 | *map |= GENMASK(start + nbits - 1, start); | ^~ In file included from drivers/net/ethernet/intel/ice/ice.h:7, from drivers/net/ethernet/intel/ice/ice_lib.h:7, from drivers/net/ethernet/intel/ice/ice_switch.c:4: drivers/net/ethernet/intel/ice/ice_switch.c:4929:24: note: 'possible_idx[0]' was declared here 4929 | DECLARE_BITMAP(possible_idx, ICE_MAX_FV_WORDS); | ^~~~~~~~~~~~ include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP' 11 | unsigned long name[BITS_TO_LONGS(bits)] | ^~~~ %ICE_MAX_FV_WORDS is 48, so bitmap_set() here was initializing only 48 bits, leaving a junk in the rest 16. It was previously hidden due to that filling 48 bits makes bitmap_set() call external __bitmap_set(), but after making it use plain bit arithmetics on small bitmaps, compilers started seeing the issue. It was still working because those 16 weren't used anywhere anyhow. bitmap_{clear,set}() are not really intended to initialize bitmaps, rather to modify already initialized ones, as they don't do anything past the passed number of bits. The correct function to do this in that particular case is bitmap_fill(), so use it here. It will do `*possible_idx = ~0UL` instead of `*possible_idx |= GENMASK(47, 0)`, not leaving anything in an undefined state. Fixes: fd2a6b71e300 ("ice: create advanced switch recipe") Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Signed-off-by: Yury Norov Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 8d8f3eec79ee..9b2872e89151 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -4934,7 +4934,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const unsigned long *profiles, bitmap_zero(recipes, ICE_MAX_NUM_RECIPES); bitmap_zero(used_idx, ICE_MAX_FV_WORDS); - bitmap_set(possible_idx, 0, ICE_MAX_FV_WORDS); + bitmap_fill(possible_idx, ICE_MAX_FV_WORDS); /* For each profile we are going to associate the recipe with, add the * recipes that are associated with that profile. This will give us -- 2.35.1