From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F66C3749E8 for ; Thu, 11 Jun 2026 21:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781212066; cv=none; b=PC8xTBHVpBP8O2CuCYqJxBY5XZ8jaVHHve3o/gBaJftZKVm4zJrvBFCyrviVbUT6rhONHWjky9ESZ66E1dYNowtJ/A5ioE3sqNP8ZxpQzOEdon8qxGLR56FnefaId7fYjQPybCzXuV23YviTrz9Tjtbb8C5fh3dJrl/7GSny4M8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781212066; c=relaxed/simple; bh=FhI2APYt+4/QJVRA2SyiUcYBi407KrWDfJ01MWqJtK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tl25WMfqtT01/G4OCT2Tl3b8IO0/Ab2jIPaHvXgPGqj/GkFDyDeRvMLG/ufEiIj9F+qEL3SFjnnS+gS1/oDkEqAavCrpYVgwB0pyp1sZrxbRYEY1gEozj8Zl+rJSNggWWzCLU7XLnTjgdNgvoZIebzG4Kxqjy5Z7hdxMoyG9UM8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UCP7iUXh; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UCP7iUXh" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2c0c2d8b95bso2359655ad.1 for ; Thu, 11 Jun 2026 14:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781212064; x=1781816864; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U4LqIqcR28wVKNTcplRcL0sj6x/zHUyaukQuodAoubU=; b=UCP7iUXhm+LVdUrz2dtHec7KhoFJbDfm0ljlolJpn/rKtetMRBzzFP1zq3Sn0gak0t VqI26Z/L7cQiVJ3oVD0rZkGY7+dKjee6inYKXPxugAICSBcoxg9IIwMcdwYrNpZmzY8X QfI//iV3xF/EKq4CwhDiJa+lRskgTDAMssE0NqpNYyfG8h995jwq5j8qJUBgjG/i+pgt ksmV4BS0CTD+dgHPQ1jQhMHs7SVJMeLmQxWPKAUCypSOwzkYXWssQvhP0WiGA9c+zIhD IVHD86y1hBvfK/1G9Ecs1qItpdZCMCQ9cCLEZfS62d4jAflkbvDfoNds7l2rJCuxkt2D WwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781212064; x=1781816864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=U4LqIqcR28wVKNTcplRcL0sj6x/zHUyaukQuodAoubU=; b=bwdSRbAQlxEJJJAbwX+Jux7iYxlVEjw6DsAUNtix2bQMuqeyHTDgm8EKtRY5xpX63h KCGg6xLpOSl+7srdHX6kPXl4R/Dgpq2TPWdd9hTmNncYhoL+5lml/bY3EHKEriUOdg9v ZJ4zPkAVKaQCHoB5U/Dl1iDNt9KLuoGx1wZxGnev8y4f8N0Nn63U91WTw03YAlv5KKfI xRrTlp07TwjJATgrW/biSiI0Y9fy4TkvkR7R+lFZu3cTxwOMNDt5jeE7T/UNHVMEQ6UK st5blizArnedlbRHrgnWjglW+w0OFhoXs5C7Gc8hUseuwkZXk/18h4YJPSoQBWyMAi+s ZuUA== X-Forwarded-Encrypted: i=1; AFNElJ88TWb8nefKZx67EZEQ/rA6MOD49fZb6izlxVP/7leIvC2f+BjyM40TRydg5EARRUV/y+cYODVwwuEr5W8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0sHLil0kXyyGsE70Y2mck68GmMrxK4RXYe7pSedQ/78cY7xqH bw8PaF94hBCHbdtmaQ95KJE03PxLhDEzNpt8c98qMYhbi0WwIAZVWsQs+vHuIw== X-Gm-Gg: Acq92OHXHh3RG+32lrIF8/5V4+8gzPGaFwUJDtZaMov6DSu7QO0th+HBmhozJj1OzC+ sByrZQHbNqmwEUaG+M+jrrjl4SD6biUNw4JWO+kNBtIOOcUr/arPc+aMMSg4aPAUrsb9J4qWAh5 wnQQ+/OS70/StbBM1MMI+lMJMoOlq+/NOR74iX8A+RLPjvR+iYu/0XL/4mD42avakNqhc0TmBSP LAAsTIOSGIiVq1gnCTJGdfFR1oaVBi7H7iHqo3wxKzqoPEzP3lrNjO66N2VNiVuPr49TfocYMp6 SD5QyoHUUATVH1rP44Beq0HrCKAngNpomy5+WaVb/uuPU56aAvr+5cbrr/d6tIoQlkn52VSlD/4 YQ2DjlFEOq777TEVbn3HnXJy/DQb3OtReKgKNvblvLuEZNbciWaqEbycitH4rndcUp4K+rF669u plepL1ZB3Hgcq9lxvdSUV3nDzUIQxMsjcKm3clDntRC6sDOEWHhkrhn2NyXSXtcLfTjVhhjVPai DqLg8e/o3xXeTxB77eT9yAhFcfE55z1G1w= X-Received: by 2002:a17:903:298f:b0:2c0:cb0e:ac42 with SMTP id d9443c01a7336-2c410ae2b51mr1097205ad.3.1781212063884; Thu, 11 Jun 2026 14:07:43 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:6d3a:64fc:4ee8:9cc3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c411d79289sm389995ad.14.2026.06.11.14.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 14:07:43 -0700 (PDT) From: Rosen Penev To: dmaengine@vger.kernel.org Cc: Vinod Koul , Frank Li , Thomas Petazzoni , Gregory CLEMENT , Marcin Wojtas , Rob Herring , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv2 3/9] dmaengine: mv_xor: bound maximum channels for Armada 37xx Date: Thu, 11 Jun 2026 14:07:15 -0700 Message-ID: <20260611210721.81979-4-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260611210721.81979-1-rosenp@gmail.com> References: <20260611210721.81979-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For XOR_ARMADA_37XX the driver set max_channels = num_present_cpus() without bounding it by MV_XOR_MAX_CHANNELS (2). On a system with more than 2 CPUs this lets the probe loop write past the end of the xordev->channels[] array when the DT describes enough child nodes. Add the missing min_t() guard. Assisted-by: opencode:big-pickle Fixes: ac5f0f3f863e ("dmaengine: mv_xor: add support for Armada 3700 SoC") Signed-off-by: Rosen Penev --- drivers/dma/mv_xor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ef29e8be1db6..588af337afe3 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1387,7 +1387,8 @@ static int mv_xor_probe(struct platform_device *pdev) */ max_engines = num_present_cpus(); if (xordev->xor_type == XOR_ARMADA_37XX) - max_channels = num_present_cpus(); + max_channels = min_t(unsigned int, MV_XOR_MAX_CHANNELS, + num_present_cpus()); else max_channels = min_t(unsigned int, MV_XOR_MAX_CHANNELS, -- 2.54.0