From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 7DAD328E0 for ; Thu, 2 Apr 2026 08:54:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775120090; cv=none; b=DsW0UFeXzn320z4ykbjFAP7GwsFA69gqOerYecp1HmiRaOQHNNp35CfNSLLI4ZexxcT1P5zfwcaONfk4gIZgdCVrEeedEOkmwgtuXBT7sth8yyLiEvFydXDpYzQEiVcuRImVOxedvsJydToNe8fY7VLuuucEvdI/nBgMj5lA+iY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775120090; c=relaxed/simple; bh=TmXtfrkVEQnquTCvxTkGtndXJ71C/6/lm3RkiXKS5DI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o7qaP3hKrGNCvJfVnHqpfUa70vgUp/yI7IrQmZWMffcdPcT2lhsAoKDBQBDN5JJxvxN3wJJkUyLDpzeyOBJdJVFV2mUeRIUsL/JSRol2OQMx8/8L+kor9/5Xw4XUIOveooBYLf2xsKCUknZNJZ4IWUzhV1bTSPojYUnXxIxD+VE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UGgNpv97; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=DfJKtm+b; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UGgNpv97"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="DfJKtm+b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775120087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fR2GdOsoccNygo6JqgvzAS/wYB5w56TPtdWluZ2eAI0=; b=UGgNpv97e7xwCY4irYpGBhtn16AUow/R1LaN/jkGA/vKlCiTOd+KdXWq3YM5rUHrbW8C+t bFiiqSWySsB9lOEJ+Yab66hQdiiTb4PNa4o72iKIKVczohPhCNzeAqeQ54ee89lKYE2HM5 aJJUtXGOZQPFykjZ7Wskw+RU7Bo1uzY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-150-EotrWd4MOL6_ylFh_HrwFw-1; Thu, 02 Apr 2026 04:54:46 -0400 X-MC-Unique: EotrWd4MOL6_ylFh_HrwFw-1 X-Mimecast-MFC-AGG-ID: EotrWd4MOL6_ylFh_HrwFw_1775120085 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-486fc42c83aso5368675e9.0 for ; Thu, 02 Apr 2026 01:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1775120085; x=1775724885; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fR2GdOsoccNygo6JqgvzAS/wYB5w56TPtdWluZ2eAI0=; b=DfJKtm+b5gXvZbryMu8d+RW47uvvbYOzIAxitd8pyD0Js9czDTQfn0upguTpz69UXN c59c0xrvSSIOJapp2rQqkwbAIYAv3m/zwYAq6mrpCXbxaUbYdju0u7L+0LhGPQq5jK+s GYQtqVtGhml2nD9kSqcK9aXV07rIXdEL6LU+WbPAc1kFw5usjLjsyh5QmYzFH+jyX3mm fEwzLHhjNp/XLu2XfgpRb1tk0KNaZMEqJi4GIMkxxkQxZTJcZ0ZEixLzts1/SvOha/iX nwSHD7rAX6tDiBi/c6kUur+Tuh5wZfvuHQrAqjhvIPtpV5oQe1e+CndLw3J3M1i53v+9 cZmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775120085; x=1775724885; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fR2GdOsoccNygo6JqgvzAS/wYB5w56TPtdWluZ2eAI0=; b=TRGO32f2tb740L/aTWJyPR9qSBYgOGL3oOkEvxOjTNYdAtdc6jicy6gLcG6s5wEKlv 5D53Ejxnli5R7sVoJa9d+/kEKRcxN+EwnGJ4HzZPu1364z5/QjVCCy2oQUpJgBMeH+8X VeyHMUZDY62djnFdSL2GUk6w7Kpq9Bo8X190DfpPBU8IPmwvmF1nlrmhTiLzVUMZ3Q4F oh3dgBuXJVl2qZUmHCDEKy6LpgWYEhCcelNSEqncVdz+Ucd3aVZA3SYfmZ7k0aKUm87D b8WMkLAwdYl8KVQkXZQ1SkUL2bk1u25cg9pEtjqs3ZUBcwZuF7fVCdKp6XQU5dSc177W GYFw== X-Forwarded-Encrypted: i=1; AJvYcCUVxCjfOomnoEhVUlxW86k33Uk5xFUqTad8xInVIpDoMYAxkYFh7h6wDBGyfpVlcvGWKp42FKAB0qaCHao=@vger.kernel.org X-Gm-Message-State: AOJu0YwdOqKdCF3rKBUePzcG69aLhIfl9r6GCnatvQLEpg08WtukmGq6 sGiGGVe4AkeOfuY1j5j8bAf+sfAfsWa/Uwsv8wVGM9XKMTh9kL7y4pZpAubO5L4G3+KTBjqz6bD P50PY/LXqE4fAk+mcBB1cmgapEm5OqkwyLOMwxrf6XmzAWF64E+PQk++WZ40T/5LxEw== X-Gm-Gg: ATEYQzxzSBGaHctyOxvMUtZ3eNAx1sOBI7E6+0vrDfvlDaarORc7alDb5ogKLo9id53 +U9P4rsfLMXmOhhqCLtd21+Y7Ae4NforNpklW7TYfTJ9iQp7UMj94YzN9hGSvjf7GtkEOvzPELs KX2D4jbb9hDjYUU6oKzJGPbjRdU2ImK+kHe/5QI/g/KypTg59AcbZyNPykqJH8x6OnSJxwbvfBB Ij2owc2/rxCGo/M1iW0fb4e9CskSXrZyKYcjae3DoIrypGPV5cSATBEXfM1+X/96h8KnxoWxWHZ Ney52M3WAT/16AIRuvlsE1whQxb55J5k4EDUUf8m9ME2in0Ac0soUqmCmkpCzCPkgRH/lzzUWR8 THzfNt0Ow8UT+GqnSZTu4Zkv2PJ35W3pJEQNdsfy6Pk7w1CWmSDzvN/Ox3Q== X-Received: by 2002:a05:600c:1d16:b0:485:3e19:9e01 with SMTP id 5b1f17b1804b1-4888359d2afmr115404895e9.28.1775120085094; Thu, 02 Apr 2026 01:54:45 -0700 (PDT) X-Received: by 2002:a05:600c:1d16:b0:485:3e19:9e01 with SMTP id 5b1f17b1804b1-4888359d2afmr115404265e9.28.1775120084622; Thu, 02 Apr 2026 01:54:44 -0700 (PDT) Received: from [192.168.88.32] ([212.105.153.248]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4887e93cf2dsm162267625e9.11.2026.04.02.01.54.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Apr 2026 01:54:44 -0700 (PDT) Message-ID: Date: Thu, 2 Apr 2026 10:54:42 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 net-next 6/6] octeontx2-af: npc: Support for custom KPU profile from filesystem To: Ratheesh Kannoth , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Cc: sgoutham@marvell.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, donald.hunter@gmail.com, horms@kernel.org, jiri@resnulli.us, chuck.lever@oracle.com, matttbe@kernel.org, cjubran@nvidia.com, saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, dtatulea@nvidia.com References: <20260330053105.2722453-1-rkannoth@marvell.com> <20260330053105.2722453-7-rkannoth@marvell.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20260330053105.2722453-7-rkannoth@marvell.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/30/26 7:31 AM, Ratheesh Kannoth wrote: > @@ -1635,9 +1651,9 @@ int npc_cn20k_apply_custom_kpu(struct rvu *rvu, > } > > /* Verify if profile fits the HW */ > - if (fw->kpus > profile->kpus) { > - dev_warn(rvu->dev, "Not enough KPUs: %d > %ld\n", fw->kpus, > - profile->kpus); > + if (fw->kpus > rvu->hw->npc_kpus) { > + dev_warn(rvu->dev, "Not enough KPUs: %d > %d\n", fw->kpus, > + rvu->hw->npc_kpus); > return -EINVAL; > } AI review says: --- The bounds check was changed from profile->kpus (which equals ARRAY_SIZE(npc_kpu_profiles) = 16) to rvu->hw->npc_kpus (a 5-bit hardware field, max value 31). Can this cause an out-of-bounds write? In the subsequent loop at lines 1658-1685 (visible earlier in the function), the code writes to profile->kpu[kpu].cam[entry] and profile->kpu[kpu].action[entry], where profile->kpu points to the static global npc_kpu_profiles[] array that has exactly 16 elements. If cn20k hardware reports npc_kpus > 16 and the firmware provides fw->kpus > 16, the new check passes but the loop iterates beyond the array bounds, corrupting adjacent memory. --- Also there are several remarks for sashiko, some of them looks valid: https://sashiko.dev/#/patchset/20260330053105.2722453-1-rkannoth%40marvell.com please a look. Thanks, Paolo