From nobody Sat Feb 7 06:13:30 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 2912D34D4D7 for ; Mon, 22 Dec 2025 17:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766423424; cv=none; b=oZe2Upo9Pfw7eXw+fD32NbcmKVaOABkpsiaictvKkbOeHd/Yj2Du2y+w4MKGpOASyQy1dd1XmVB+v/+cTCV1f25dZUN82Y/sOWhMeGyFkes8MYE/edPQQFXObYCRFD58pHzD78ZQPwHKown1sx9nWzYgpvn7kL4//0Ekoh89T4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766423424; c=relaxed/simple; bh=YzHI4G0+hRrgBsdVGircsVPa5FNf/xrUmMBxU/P9OYY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EdS3dc0OZUdzVVviSDBEiC0y5UHPWgrdy8N95EnSpn/7/NPiET/CqBXJmgzC2+2v6fAQYSPj8E39VJ5295f6utWyqOW48RWRZ+/7N7tmMRjFut5G2UGQRxtBobOp72NYsFCMjseLGNSyt7MM0QLfOk/3yAlbkJObKnisGlUy+CI= 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=mBuS/7sq; arc=none smtp.client-ip=209.85.214.170 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="mBuS/7sq" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-29f102b013fso51589715ad.2 for ; Mon, 22 Dec 2025 09:10:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766423422; x=1767028222; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Twwl3eXQOJJG8t6zXbxVANRhPz0XPO3mVRHYXpjMWBk=; b=mBuS/7sqWuuU9uiMFdFQ9Df5qz2SFh8Qr2LpkE/hPgNaGrHq3+nWCe4HEttwYNrjV7 vuJ+Fh9UWaYfo0a/LRNaXfuCdIPgU5QFavvqGPthODFs73fgvC2pegMnju8R18E2Gf7f GtoPT9DMCJCyl3jL9nc6TcvPLlEb81QEh8WNnMTg18xgxSY62mcV7MxySNwDr67CbGd9 6Sp8n18QRU1kOefjLvL/zNaTdPNMdmJbKG8xDo9w4smsm0sKNcbRaO7FnveZO9REQuCb rYGLgZV3N+cLUWdd9RnSvfjGagDbJh7KBW4UtojAe/N5LytGr6fVc1JZFosnoUrqdIaT 3+Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766423422; x=1767028222; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Twwl3eXQOJJG8t6zXbxVANRhPz0XPO3mVRHYXpjMWBk=; b=Sd21elImYVduYigJzEdMgTMbBwu/S7LvVFICbFg6d8fGYVumFcX4ganoEzmYR6dNOU 15HwlEmQxkrv5z3xwHAL4MWO6wKtiM5pzUCY5b8WmYZtYdypC7aAoD6yIjN0n5FSjy65 OhPJ2IC/x+jl6SZAbEx/3aMZqFCYepRw9kIa4cinhN06A0H5LDEYXAHXkrPkIU1Q3f0l 2Jzy/oUHL39faoI8DRZa5p2liWaT0ccxRCPYV33S5xP182leQ2YqosV9d8lDE4E6bARZ D/pthGWMIGnoVyJ6pfYroxEY6na7iGHG3ryFwExK/f1XrLtXk4fqWayspFA2Uhj9Puoz 3wJA== X-Forwarded-Encrypted: i=1; AJvYcCVpChVW96cKs1I9HZw/Aw6cmlvdcSpWIUNpJXo6U4coFl7UtHHzQEjJsG5Hc9h2aYBGoUa5QAWNvnl+QKI=@vger.kernel.org X-Gm-Message-State: AOJu0YytcCtrx6lwB6uEzpz2q1e7g4g8qrfQDrzhyE/+FOU7WNEtjD16 fqrKCieYwvhVPpxapwGp0HIwLFsneq5I0miERn1TgxhkaaBKgNoFeVwr X-Gm-Gg: AY/fxX6A1MdpsXZIv6K+hV0epLyRQFx1VwVDDXVbEl2gbaVVWB92uYQsD4ryfEfNcYt xfyXsyGVF1SL8wgVB5jh+0pQsLOhvTeZQ8K3GDgy4T+JeInPWYntypndvuayhtA8YeebQ0F3jG3 QUpD1yZ1rg+P/Ppg89uR5xJPcFz5kw8fdsEe6nGzSgIJHPfY81I5OkLllxL6GjJ0+qATstCcQWk Wqghb6t7MtwSMet87nUwRjJ8avLpvax1/LH5Krs/nzBW0/+nqSS1jIC+5JHUSx9h9GTyBmXoG1v snPIE3kdrgh+/RNwPjbkE7X0Zzcp03zI4e+pYmnJoi9q0xDnr5pqq3lWLxP7r6YKLbtlqUdxiKH PeYI40G7GrxUfoHM4IE1+rsyOoY/CjH6I0EjqfQbVY5L9RL8Vwu3a3s/iwxV8GfOILhh0SUDFmJ d6/jBTyN2pGMfIcxSGSA== X-Google-Smtp-Source: AGHT+IFGwoIvh/LClRN4uv8g8aCVZAOzLpRcs94hUY6IVuWUkgSsBL0HmTW1Es/wVhGveE4O22vjUw== X-Received: by 2002:a17:902:cf08:b0:2a0:f488:24e with SMTP id d9443c01a7336-2a2f2836817mr121946555ad.28.1766423422153; Mon, 22 Dec 2025 09:10:22 -0800 (PST) Received: from rakuram-MSI ([2401:4900:67c6:fbd5:bf35:e32b:9520:be9e]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3d4cb25sm104508575ad.56.2025.12.22.09.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 09:10:21 -0800 (PST) From: Rakuram Eswaran To: joro@8bytes.org, will@kernel.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, iommu@lists.linux.dev Cc: dan.carpenter@linaro.org, lkp@intel.com, linux-kernel@vger.kernel.org, rakuram.e96@gmail.com Subject: [PATCH] iommu/amd: Drop incorrect NULL check for iommu in alloc_irq_table() Date: Mon, 22 Dec 2025 22:40:08 +0530 Message-ID: <20251222171009.44670-1-rakuram.e96@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" alloc_irq_table() contains a conditional check for a NULL iommu pointer when computing the NUMA node, but the function dereferences iommu in multiple places afterwards. All callers ensure that a valid iommu pointer is passed in, and a NULL iommu is not expected by the current callers. Remove the incorrect NULL check to make the assumptions consistent and address the Smatch warning. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202512191724.meqJENXe-lkp@intel.com/ Signed-off-by: Rakuram Eswaran Reviewed-by: Ankit Soni --- Testing note: Compile tested only. Build and Analysis: This patch was compiled against the configuration file reported by 0day CI in the above link (config: x86_64-randconfig-r073-20251215) using gcc version 15.2.0 (Ubuntu 15.2.0-4ubuntu4). Static analysis was performed with Smatch to ensure the reported warning no longer reproduces after applying this fix. Command using for Smatch testing: ~/project/smatch/smatch_scripts/kchecker ./drivers/iommu/amd/iommu.c drivers/iommu/amd/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 075125f0f52b..611e3ccc93d1 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -3240,7 +3240,7 @@ static struct irq_remap_table *alloc_irq_table(struct= amd_iommu *iommu, struct irq_remap_table *new_table =3D NULL; struct amd_iommu_pci_seg *pci_seg; unsigned long flags; - int nid =3D iommu && iommu->dev ? dev_to_node(&iommu->dev->dev) : NUMA_NO= _NODE; + int nid =3D iommu->dev ? dev_to_node(&iommu->dev->dev) : NUMA_NO_NODE; u16 alias; =20 spin_lock_irqsave(&iommu_table_lock, flags); --=20 2.51.0