Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp634135lqh; Thu, 28 Mar 2024 11:28:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLu7sTB6n3ifyZ5YflLkYGJgFGKBCsr6Iy73oXneSOFsLz7dqnK0sDgiM2VIcPL3IZ8nXz/5j8lPRYGwMOhAPM0FSZlbbDhdBgtDMzQw== X-Google-Smtp-Source: AGHT+IHEdwvUd+NA0CDrVJ+uMmjpBdViYemrZuRl77WE2x4kN26pl+7GCN4AKKgjKLtOKO/wuMNj X-Received: by 2002:a05:6808:ec2:b0:3c3:bf11:a628 with SMTP id q2-20020a0568080ec200b003c3bf11a628mr50726oiv.51.1711650511463; Thu, 28 Mar 2024 11:28:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711650511; cv=pass; d=google.com; s=arc-20160816; b=sTZIukOEodX7GsjWPdXcJgftujedIllrIj3YgFPI4blhs1aNeIfzepDPCA6dJ+r6GJ 9zXcTCwubitVuUAczOMeijrtEWJ/j3wIjHkpPoLqkw+tCvsJS8CEwd/Hkgvqy6bHDy7D /59EVRLeAxxaguXuusC1nS0/kA3eH7yPJ+SrAyIymqRg0YycEM+8GsKYyzvuUf1Aidc6 KdVuHLjJSOHkbOfE1XZSBs9tcz4mcQKhR627fl9OOOXtWuaVBlZx2P2Dus77WKdlzqh3 aRR6MYymnyNON4yKRD6va69Zwi5NQo0WcmMRMlwfitNzc36t5sqgDNo/oUPx+CSw33Yc km+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=fKQF0g5b20ANH7spyd4/nx+xJJF1ScpogZHCTSO4DPw=; fh=uphILxSJ5kyuPBNGMcqrIPsH/sIExbXHiyqf/TuNoBo=; b=yrIfiRflETvaHuoat+6whrr1pHocQsejYdwa5SElvq9VNXH7fsD4Wmpb8xI0iW/X8P vEaVdd9vv7w2ibYFhLdj0tVxukf+TzHZ7f+y4OSGoYItDNHg4RP0dfKXTJjs77iJdDk/ zW/rV26LWjN/t3QakMgdh/mDDO6OkolRpgyXJKt+jydIu9dLuzJXpuPG6IIcrSgjYOJI 6q5DiQZpv1riCBVfavJjA3IBG6JHZJjZnlcWW8s5krVoknZez5evRPgTV2VPhR+MipJe tgWyb0942xhzyR84HKbPolvDQNwPH8OTpCRb2LVPvmjauC508jMLKD37MslxuVyF6Dum 8sVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e/+K/ruK"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c7-20020a05622a058700b004313784e941si1950779qtb.437.2024.03.28.11.28.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 11:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e/+K/ruK"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3018A1C21CC0 for ; Thu, 28 Mar 2024 18:28:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9C0D134419; Thu, 28 Mar 2024 18:28:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e/+K/ruK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFB2712FB36; Thu, 28 Mar 2024 18:28:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711650501; cv=none; b=bO+1Z4IeFoyWgI0Jcng6JihJpgbytqGBfcnXuZqR1r7MMzNM0QXGf1TAyqHRP2XA6u1gS0eNS38bqldBKgbdtxkE0YLYlrI/Bp0VY05kbeJNffGF/N8uKMA1XX/XZ08B2JZ5R3Bb3SLcd4zopN2SneMmkInYuXX88rilXFmelEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711650501; c=relaxed/simple; bh=qnTHkMKWFqmASjF7Mj+8qIPTwlEXLcYYW+bC2hrrVzU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WIDDJNcxu+OPLn6XFdQEXjf+Lx4QQEj5Q/1qO2B/hZ8IC2j8mXX0OdvqzvoyqbV/FyL0dEovxi6zNQKd3iqNZf/L9aCMvYBc6k1ioQN2hCQX4922OJbWXluvBUPnKM7xzjZ+7vPRCfrfUsR9t5K43WiY1MoWzLxYYd4sDdTSjhY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e/+K/ruK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAAD7C433C7; Thu, 28 Mar 2024 18:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711650500; bh=qnTHkMKWFqmASjF7Mj+8qIPTwlEXLcYYW+bC2hrrVzU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=e/+K/ruKxZb7JvjBJcoirN9aLxCRTyZpGFXYzUtBh+XcBHlV0RLiUsH/ELMzaekKK ic8Nr98JWNxPmMjJ5WNnrQZNNpxdHB/45BjPqVo1D6qftZvJfRTg+gvZrvJ8BcXm5U umsPNXdQ8/3IAa4gLPFPMo0s8Th6f6V6vxeDnqEkXlInG9ek42QSvSlcscILVfMI8j r5iLLBn583f4KnMLhZNOL0p1JvYvoEOsByhDSxO9yYlagbTfv3x0pXgq6N2sOpbGHJ FKy6I0g4ow/sRsXYFyAk0S/NqWtvzxMOcRgmnf7Mg4zyrGoqhzClmGc6Iw7YWIZVMy EOg2vtGhCfuDg== Date: Thu, 28 Mar 2024 11:28:18 -0700 From: Jakub Kicinski To: Aleksandr Mishin Cc: Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , "David S. Miller" , Eric Dumazet , Paolo Abeni , , , Subject: Re: [PATCH] octeontx2-af: Add array index check Message-ID: <20240328112818.49c0de17@kernel.org> In-Reply-To: <20240328081648.13193-1-amishin@t-argos.ru> References: <20240328081648.13193-1-amishin@t-argos.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 28 Mar 2024 11:16:48 +0300 Aleksandr Mishin wrote: > In rvu_map_cgx_lmac_pf() the 'iter', which is used as an array index, can reach > value (up to 14) that exceed the size (MAX_LMAC_COUNT = 8) of the array. > Fix this bug by adding 'iter' value check. I'm guessing you got the 14 from: hw->lmac_per_cgx = (nix_const >> 8) & 0xFULL; Seems more reasonable to cap the size at that point than every use afterwards. -- pw-bot: cr